I have a worksheet with some 200 columns. These columns make 20 blocks of 10 columns, each block has the similar structure. The same Worksheet-Change event needs to be triggered on, say, column A, column K, col T, and so on.
I can do this as indicated here below, but I am looking for a more condensed way.
I can do this as indicated here below, but I am looking for a more condensed way.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim kol_A_rng As Range
Dim kol_K_rng As Range
Dim kol_T_rng As Range
Set kol_A_rng = Range("A3:A300")
Set kol_K_rng = Range("K3:K300")
Set kol_T_rng = Range("T3:T300")
If Target.Count = 1 And Not Application.Intersect(Target, kol_A_rng) Is Nothing Then
'do something (this something is approx. 30 lines !)
ElseIf Target.Count = 1 And Not Application.Intersect(Target, kol_K_rng) Is Nothing Then
'do the same thing as in col A
ElseIf Target.Count = 1 And Not Application.Intersect(Target, kol_T_rng) Is Nothing Then
'do the same thing as in col A
'and so on
Else
End if
End Sub