I have a Macro enabled Excel workbook, and when it launches, it edits some cells and I have a change event, now I want the change event to not run at start up but run when the user makes the changes because when it does, the target.value becomes a variant and hence crashes as am assigning the value to a string variable, here is the code:
If Not Intersect(Target, Range("H83:H102,K83:K102,N83:N102,Q83:Q102,T83:T102,W83:W102,Z83:Z102,AC83:AC102")) Is Nothing Then
Dim rowNum As Integer
rowNum = Target.row
Dim family As String
family = Target.Offset(0, -1).Value
Dim selection As String
selection = "G" & rowNum & ",J" & rowNum & ",M" & rowNum & ",P" & rowNum & ",S" & rowNum & _
",V" & rowNum & ",Y" & rowNum & ",AB" & rowNum
Select Case family
Case "FAMILY 1"
Call validateFamMembers(Target, selection, family, "C64")
Case "FAMILY 2"
Call validateFamMembers(Target, selection, family, "I64")
Case "FAMILY 3"
Call validateFamMembers(Target, selection, family, "O64")
Case "FAMILY 4"
Call validateFamMembers(Target, selection, family, "U64")
Case "FAMILY 5"
Call validateFamMembers(Target, selection, family, "C76")
Case "FAMILY 6"
Call validateFamMembers(Target, selection, family, "I76")
Case "FAMILY 7"
Call validateFamMembers(Target, selection, family, "O76")
Case "FAMILY 8"
Call validateFamMembers(Target, selection, family, "U76")
End Select
End If
The code crashes on this line on start up
family = Target.Offset(0, -1).Value
how do I handle that. Thanks in advance