Results 1 to 10 of 30

Thread: Class related Stuff Userforms

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10

    Answer from Richard

    https://www.excelforum.com/excel-programming-vba-macros/1138300-vba-userform-value-check-if-user-form-buttons-checked-not-working-check-button-on-open.html#post4380955
    https://www.excelforum.com/excel-programming-vba-macros/1138300-vba-userform-value-check-if-user-form-buttons-checked-not-working-check-button-on-open.html#post4380967
    https://www.excelforum.com/excel-programming-vba-macros/1138300-vba-userform-value-check-if-user-form-buttons-checked-not-working-check-button-on-open.html#post4380992
    https://www.excelfox.com/forum/showthread.php/2965-Class-related-Stuff-Userforms?p=24169&viewfull=1#post24169








    Answer from Richard ( RIP (: )

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    There's a lot to comprehend there. You'd be better advised to upload the workbook so that we can see this in context.
    Clearly explain where you want to check for the condition of your option buttons.

    However try something like
    Code:
    If UserForm1.OptionButton1 Then 
        '....your code if option button has been selected
    Else
       ' Code (if any) if ob not selected
    End If

    Quote Originally Posted by Doc.AElstein View Post
    Hi Richard


    Thanks for the quick reply.
    The File I gave a link to at the end of Post #1
    ( Sorry it is a bit too big to upload, and reducing the data is difficult as I explained. )

    Also I showed where I Have the two required If 's
    Sorry there was a lot there.
    I was also sharing my Workaround, and trying to be as concise as possible.

    Thanks very much for your code I will try it out
    Alan

    EDIT:
    P.s.
    Richard: I ammended the title after this was solved, as your answer was excactly what many people thought and indeed what I still Google. I know why. This will catch a lot of people out so I will do a last follow up Post to Explain
    Alan
    Quote Originally Posted by Doc.AElstein View Post
    Hi Richard,

    Ok I tried the demo code kike this following your suggestion,

    Code:
    Sub CheckOptionCheckCheckedCheck()
    Dim v As Variant
    Let v = ufResults.StatusBarNormal.Value
    Let v = ufResults.OptionButton2.Value
    Let v = ufResults.Refresh.Value
    End Sub
    That does not error. . - I guess I should have twigged to that. I never stop telling OP’s to fully reference things like Workbooks and Worksheets thus:
    WB.
    And
    Ws.
    Etc....

    Logical that the same applies to User Form things
    UserForm.
    And that explains why of course it worked within the User Form ( ufResults ) codes!

    _..................

    But in the demo code, ( which I have in a normal module ) it gives False for
    v
    even if I check the Button StatusBarNormal


    I also put this line,
    Dim v: v = ufResults.StatusBarNormal.Value
    in the
    Private Sub Worksheet_Change(ByVal Target As Range)
    In Sheet 1 ,
    then
    put a stop on it,
    then
    checked Button StatusBarNormal
    then
    initiated running of
    Private Sub Worksheet_Change(ByVal Target As Range)
    ( by putting a number in any column C column where there is a Food in column A )

    Then I Debug Mode F8 to go past
    v
    Then I hover to see what is in v , and it is still False, despite Button
    StatusBarNormal
    Being checked.

    So I am not quite there yet....

    I will keep at it

    Thanks again for the reply

    Alan
    Last edited by DocAElstein; 06-01-2024 at 05:24 PM.

Similar Threads

  1. Class Stuff: VBA Custom Classes & Objects, Class Modules
    By DocAElstein in forum Excel and VBA Tips and Tricks
    Replies: 29
    Last Post: 06-02-2024, 01:49 PM
  2. Replies: 42
    Last Post: 05-29-2023, 01:19 PM
  3. Test my rights , to do stuff
    By TestAccount in forum Test Area
    Replies: 0
    Last Post: 10-07-2020, 11:49 AM
  4. Backup all modules, class modules and userforms to a selectable folder
    By MrBlackd in forum Excel and VBA Tips and Tricks
    Replies: 1
    Last Post: 04-06-2014, 08:33 AM
  5. Pass Values Between Multiple Userforms
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 07-24-2011, 03:25 AM

Posting Permissions

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