+ Reply to Thread
Results 1 to 4 of 4

get state of checkbox on worksheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-21-2008
    Location
    Hamilton, New Zealand
    MS-Off Ver
    Office 2007
    Posts
    255

    get state of checkbox on worksheet

    I need help to get the state (xlon or xloff) of check boxes on a worksheet.
    i have tried the following but unable to get it to work.

    Any solutions would be much apprecaited
    please see sample workbook attached.


    Sub showvalue()
    
    Dim myshape As Shape
    
    For Each myshape In ActiveSheet.Shapes
        If myshape.Value = xlOn Then
            ' do what i want here
            MsgBox myshape.Name & " is on"
        End If
    Next
    
    End Sub
    Attached Files Attached Files
    Last edited by wotadude; 01-15-2009 at 03:20 PM.

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hi wotadude. Use:

    If myshape.ControlFormat.Value = xlOn
    HTH

    Jason

  3. #3
    Forum Contributor
    Join Date
    08-21-2008
    Location
    Hamilton, New Zealand
    MS-Off Ver
    Office 2007
    Posts
    255
    Thanks Jason, that worked a treat.

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Glad it helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1