VBA question
I couldn’t find the answer googling but I’m not finding what I need to know.
I have a spreadsheet with a command button. It opens a userform that has several combo boxes. The user selects an option for each, and then clicks a command button. I have to run a certain calculation and return the results to the spreadsheet based on which option they chose.
Now I know how to return the results and all that stuff, and already have the equations working. I just have them ALL in the command button that closes out the userform. I need to put them in subs somehow and then call them I think, but I’m not exactly sure how. Anyone wanna chime in?
You can create functions – is that what you mean?
Function YourFunction(YourArgs as Long) as Long
YourFunction = YourArgs * 10
End Function
If you are only returning a single value (string or number), in the code for the form get your values from the combo boxes. Do what you need to them (Math, If Statements whatever) then spit out the result using the Range(application.ActiveCell.Address).Value property.
Related posts:
- VBA/Macro help I have a simple excel sheet with this information in...
Related posts brought to you by Yet Another Related Posts Plugin.