-
multiple target address
Hi, trying to trigger events is cells in multiple traget addresses are selected.
I have merged 3 cells together eg b10:b13 are merged but selecting cell is cell b10
I have 9 of these from B10 to B32. I'm trying to use below code so if I am selecting any of the 9 cells my other events trigger. My below does not trigger not sure why..
[vba]If Target.Address = ("$B$8:$B$32") Then
If Range("ac2") = "I'm here" Then
MsgBox "Unprotecting for Budgetary adjustments
End If
End If[/vba]
This is in the worksheet selection change.
-
The address of the cell is not the entire range. Try:
[vba]If Not Intersect(Target, Range("B8:B32")) Is Nothing Then
If Range("ac2") = "I'm here" Then
MsgBox "Unprotecting for Budgetary adjustments
End If
End If [/vba]
-
You do it using targe.cells.count like this[VBA]If Target.Cells.Count > 1 Then
MsgBox Target.Address
Else
MsgBox "Not merged " & Target.Address
End If[/VBA]