Hamond
01-11-2011, 12:04 PM
Hi
I have a useform containing checkboxes (called: Daily_Click, Weekly_Click, Monthly_click etc). Based on which checkbox is clicked, I want to set a global constant parameter that would feed into macros in the main module for a variable called "Freq".
So for example
If the UserForm1.checkbox daily_click = true then value for Freq = "D",
If the UserForm1.checkbox weekly_click = true then value for Freq = "W"
I then want to feed this constant variable into several macros such as the one below:
Sub Test()
Sheets("Transformed").select
Range("A3").Value = Freq & "1st Difference"
End sub
Is it possible to set Freq as a constant global variable depending on the checkbox that is ticked?
I have tried putting something like the following at the top of the module but I don't know how to make it conditional based on which checkbox is selected by the user in the userform.
If UserForm1.Daily_Click Then Const Freq = "D".
Hope someone can help as I'm really struggling to work out the best way to do this.
Thanks,
Hamond
I have a useform containing checkboxes (called: Daily_Click, Weekly_Click, Monthly_click etc). Based on which checkbox is clicked, I want to set a global constant parameter that would feed into macros in the main module for a variable called "Freq".
So for example
If the UserForm1.checkbox daily_click = true then value for Freq = "D",
If the UserForm1.checkbox weekly_click = true then value for Freq = "W"
I then want to feed this constant variable into several macros such as the one below:
Sub Test()
Sheets("Transformed").select
Range("A3").Value = Freq & "1st Difference"
End sub
Is it possible to set Freq as a constant global variable depending on the checkbox that is ticked?
I have tried putting something like the following at the top of the module but I don't know how to make it conditional based on which checkbox is selected by the user in the userform.
If UserForm1.Daily_Click Then Const Freq = "D".
Hope someone can help as I'm really struggling to work out the best way to do this.
Thanks,
Hamond