VBA - passing variables to Form Subs

TheNoocH

Well-known Member
Joined
Oct 6, 2004
Messages
3,482
i'm trying to write a small app which will have one main User Form...
usually i get around variables by writing and retrieving data to/from worksheet cells...
this time around though i'd like to see if i could do everything right in the vba (ie instead of going to the worksheet)...

here's a part of what i'd like to do...
1) when the form loads up i run a module to initialize the form and variables...eg let's say i have a variable vStatus that I want to hold the value new.....----- vStatus="New"
2) on the form i have multiple command buttons ....i want to read the value of vStatus and if it's New then if i hit one group of buttons (let's say the group of buttons i have at the top of the form) i want to change vStatus to a new value eg...."Top" and if i hit another group of buttons (let's say the group of buttons at the bottom of the form) then i want to change vStatus to "Bottom"

I'm sure it's not very difficult but i've never really done anything like this without storing and retrieving from worksheet cells...so any help would be great...thanks...
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Have a look at Module level or Public variables which can be seen globally by different Modules and Procedures.

Regards.
 
Upvote 0

Forum statistics

Threads
1,215,657
Messages
6,126,062
Members
449,286
Latest member
Lantern

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top