I've a Worksheet_Change function based on some drop down box changed as follow:
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$F$1", "$F$2", "$F$3", "$F$4"
Function_A
Case "$D$1", "$D$2", "$D$3", "$D$4"
Function_B
End Select
End Sub
Let say I have 100 drop down box, e.g. from "$F$1" to "$F$100"
I tried to create a string that can replace the long target address (e.g. "$F$1", "$F$2", "$F$3",....)
I've create a code as follow:
For i = 1 To 100
If i = 100 Then
String_A= "" & Chr(34) & "$F$" & i & Chr(34) & ""
String_B= "" & Chr(34) & "$D$" & i & Chr(34) & ""
Else
String_A= "" & Chr(34) & "$F$" & i & Chr(34) & "" & ", "
String_B= "" & Chr(34) & "$D$" & i & Chr(34) & "" & ", "
End If
Final_String_A = Final_String_A + String_A
Final_String_B = Final_String_B + String_B
Next
and replace as target address as follow:
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case Final_String_A
Function_A
Case Final_String_B
Function_B
End Select
End Sub
but not working... I'm not sure this method working or not so I'm trying to work on this.
Could somebody help me on this...
Thanks!
Bookmarks