Home

Formula VS Macro?

%3CLINGO-SUB%20id%3D%22lingo-sub-276500%22%20slang%3D%22en-US%22%3EFormula%20VS%20Macro%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-276500%22%20slang%3D%22en-US%22%3E%3CP%3EHello!%26nbsp%3B%20I%20am%20trying%20to%20learn%20how%20to%20use%20macros%20and%20really%20need%20some%20guidance.%26nbsp%3B%20In%20my%20example%20%3CEM%3E(attached)%3C%2FEM%3E%2C%20I%20have%20the%20formula%20working%20so%20that%20the%20various%20phrases%20are%20added%20or%20removed%20depending%20on%20whether%20or%20not%20the%20OnOff%20box%20has%20a%200%20or%20a%201.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'd%20like%20to%20know%20how%20to%20create%20a%20macro(s)%20so%20that%20the%20user%20clicks%20the%20checkbox%20on%20or%20off%20and%20then%20clicks%20the%20%22run%22%20button%20to%20create%20the%20final%20result.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3CP%3ERonna%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-276500%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-276509%22%20slang%3D%22en-US%22%3ERe%3A%20Formula%20VS%20Macro%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-276509%22%20slang%3D%22en-US%22%3E%3CP%3EDaniel%2C%20thank%20you%20so%20much%20for%20your%20response!%26nbsp%3B%20I%20think%20I%20understand%20your%20directions%2C%20but%20would%20appreciate%20seeing%20any%20examples%20you%20have%20just%20to%20make%20sure.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you!%3C%2FP%3E%3CP%3ERonna%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-276507%22%20slang%3D%22en-US%22%3ERe%3A%20Formula%20VS%20Macro%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-276507%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20Ronna%2C%3C%2FP%3E%3CP%3EThere%20are%20several%20ways%20you%20can%20achieve%20this%2C%20but%20the%20most%20efficient%20in%20my%20opinion%20would%20be%20to%20utilize%20List%20Boxes%20within%20a%20User%20Form.%20Instead%20of%20creating%20a%20new%20Module%20in%20the%20VBE%20create%20a%20User%20Form%20and%20enter%20a%20list%20box%20design%20it%20how%20you%20see%20fit.%20Once%20you%20do%20that%20enter%20the%20listbox%20data%20(example%20below)%20and%20a%20command%20button%20under%20the%20list%20box%20and%20assign%20it%20to%20a%20macro%20using%20the%20same%20logic%20you%20used%20for%20your%20results%20section.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EPrivate%20Sub%20UserForm_Initialize()%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EListBox1.AddItem%20%22Oldest%20Brother%20John%22%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3EListBox1.AddItem%20%22Older%20Brother%20Mark%22%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3EEnd%20Sub%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you%20would%20like%20me%20to%20send%20you%20example%20just%20let%20me%20know.%20I%20hope%20this%20helps!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Deleted
Not applicable

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

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!

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

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies