PDA

View Full Version : multiple target address



wilg
11-24-2011, 07:44 AM
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..

If Target.Address = ("$B$8:$B$32") Then
If Range("ac2") = "I'm here" Then
MsgBox "Unprotecting for Budgetary adjustments
End If
End If

This is in the worksheet selection change.

Aflatoon
11-24-2011, 08:26 AM
The address of the cell is not the entire range. Try:
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

Simon Lloyd
11-24-2011, 08:29 AM
You do it using targe.cells.count like thisIf Target.Cells.Count > 1 Then
MsgBox Target.Address
Else
MsgBox "Not merged " & Target.Address
End If