Consulting

Results 1 to 3 of 3

Thread: Solved: Embedded controls

  1. #1

    Solved: Embedded controls

    Hi

    Am wondering if embedded optionbuttons can be part of a sub dependent on their state.

    I have a couple on a sheet and am using the following routine

    [VBA]Sub query()
    If OptionButton1.Enabled = True And Range("V28").Value < 0 Then
    UserForm1.Show
    End If
    End Sub[/VBA]

    But regardless of the value of V28 or optionbutton selected the userform still displays.

    Any help appreciated
    thanks

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    The .Enabled property shows whether the Option button CAN be clicked. The .Value property returns whether it HAS been clicked.
    [VBA]If Range("V28").Value < 0 And OptionButton1.Value Then
    UserForm1.Show
    End If [/VBA]

  3. #3
    Thanks Mike,

    I think it also needs to be in the sheet code as it doesn't want to work in a stand alone module

    regards
    Jon

Posting Permissions

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