Hi Guys,
I'm tring to figure out how to simplify my code so I don't have to add too many if statements and make it more 'dynamic'
Here is what I have:
Global Const G_VARIABLE1 As string = "ABC"
Global Const G_VARIABLE2 As string = "KLM"
Global Const G_VARIABLE3 As Double = 0.25
Global Const G_VARIABLE4 As Integer = 10
Now I have a Userform with four Labels and four Textboxes
in the UserForm_Initialize
Private Sub UserForm_Initialize()
Dim x As Integer
lstx = WorksheetFunction.Min(cCount, ws.Cells(Rows.Count, 1).End(xlUp).Row)
Dim A_VARIABLE1, A_VARIABLE2, A_VARIABLE3, A_VARIABLE4
x = 0
With Me
For Each x= 1 to 4
.Controls("Label" & x).Caption = "A_VARIABLE" & x
.Controls("Textbox" & x) = "G_VARIABLE" & x
Next x
End With
End Sub
The thing is it places the text "G_VARIABLE1" in the first TextBox but not the actual value of the constant G_VARIABLE1
I just can't figure out how to address the actual constant and not just the contants' name
Thanks for looking
Bookmarks