Forum Discussion

Anonymous's avatar
Anonymous
Oct 22, 2018

Formula VS Macro?

Hello!  I am trying to learn how to use macros and really need some guidance.  In my example (attached), I have the formula working so that the various phrases are added or removed depending on whether or not the OnOff box has a 0 or a 1.  

 

I'd like to know how to create a macro(s) so that the user clicks the checkbox on or off and then clicks the "run" button to create the final result.

 

Thanks!

Ronna

 

 

 

2 Replies

  • Daniel Dezi's avatar
    Daniel Dezi
    Copper Contributor

    Hello Ronna,

    There are several ways you can achieve this, but the most efficient in my opinion would be to utilize List Boxes within a User Form. Instead of creating a new Module in the VBE create a User Form and enter a list box design it how you see fit. Once you do that enter the listbox data (example below) and a command button under the list box and assign it to a macro using the same logic you used for your results section.

     

    Private Sub UserForm_Initialize()
    ListBox1.AddItem "Oldest Brother John"

    ListBox1.AddItem "Older Brother Mark"

    End Sub

     

    If you would like me to send you example just let me know. I hope this helps!

    • Anonymous's avatar
      Anonymous

      Daniel, thank you so much for your response!  I think I understand your directions, but would appreciate seeing any examples you have just to make sure.

       

      Thank you!

      Ronna

Resources