joobalooba
New Member
- Joined
- Jun 29, 2018
- Messages
- 4
Hello,
I'm trying to set up a budget template for my colleagues. The first sheet is a set up sheet which contains a userform which they have to fill in. They then have to press a command button at the bottom called "Create New Budget".
Within the userform, there are several inputs for staff - e.g. "txtBudgetName" and "cboBudgetYear". Once staff have filled in these values and press the button, the sub attached to the command button has a Call "CreateBudget()" sub, which is saved in another module. The intention is that the CreateBudget sub creates the template budget sheet on another sheet.
The problem is that the CreateBudget sub relies on the staff inputs - txtBudgetName and cboBudgetYear etc, but I think these get forgotten once VBA moves off the userform and then onto the module with CreateBudget sub on it.
Is there something I can do to have VBA remember these values? Or should I just get rid of the CreateBudget sub and stuff all of its contents into the command button on the userform?
Thanks in advance!
I'm trying to set up a budget template for my colleagues. The first sheet is a set up sheet which contains a userform which they have to fill in. They then have to press a command button at the bottom called "Create New Budget".
Within the userform, there are several inputs for staff - e.g. "txtBudgetName" and "cboBudgetYear". Once staff have filled in these values and press the button, the sub attached to the command button has a Call "CreateBudget()" sub, which is saved in another module. The intention is that the CreateBudget sub creates the template budget sheet on another sheet.
The problem is that the CreateBudget sub relies on the staff inputs - txtBudgetName and cboBudgetYear etc, but I think these get forgotten once VBA moves off the userform and then onto the module with CreateBudget sub on it.
Is there something I can do to have VBA remember these values? Or should I just get rid of the CreateBudget sub and stuff all of its contents into the command button on the userform?
Thanks in advance!