L
Lava
The code below highlights the entire row I'm working on. When I leav
field $A$1 it popups a messagebox (just by example). I don't need t
make any changes to $A$1. All I have to do is leave it.
My question is.... what code should be replaced by what code to make i
work for every field in Column B? When the current cell is in column
and I press enter or move the down-cursor (or up button) I wish th
trigger to execute. Basically vertical movement in column B shoul
trigger it. I assume something with the IF condition *If Target.Addres
= "$A$1" Then* has to be changed, but what
Trial and error so far.
Code
-------------------
Dim rTriggerCell As Range
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Triggers highlight of target row
Dim strRow As String
Cells.FormatConditions.Delete
With Target.EntireRow
strRow = .Address
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:="=COUNTA(" & strRow & ")>0"
.FormatConditions(1).Font.Bold = True
.FormatConditions(1).Interior.ColorIndex = 34
End With
'Triggers an action upon user exiting cell A1
On Error Resume Next
Application.EnableEvents = False
'Entered into Trigger cell
If Target.Address = "$A$1" Then
Set rTriggerCell = Target
Application.EnableEvents = True
On Error GoTo 0
Exit Sub
End If
If Not rTriggerCell Is Nothing Then 'They are leaving A1
MsgBox "You just left cell A1", vbInformation, "OzGrid.com"
Set rTriggerCell = Nothing
End If
Application.EnableEvents = True
On Error GoTo 0
End Su
field $A$1 it popups a messagebox (just by example). I don't need t
make any changes to $A$1. All I have to do is leave it.
My question is.... what code should be replaced by what code to make i
work for every field in Column B? When the current cell is in column
and I press enter or move the down-cursor (or up button) I wish th
trigger to execute. Basically vertical movement in column B shoul
trigger it. I assume something with the IF condition *If Target.Addres
= "$A$1" Then* has to be changed, but what
Code
-------------------
Dim rTriggerCell As Range
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Triggers highlight of target row
Dim strRow As String
Cells.FormatConditions.Delete
With Target.EntireRow
strRow = .Address
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:="=COUNTA(" & strRow & ")>0"
.FormatConditions(1).Font.Bold = True
.FormatConditions(1).Interior.ColorIndex = 34
End With
'Triggers an action upon user exiting cell A1
On Error Resume Next
Application.EnableEvents = False
'Entered into Trigger cell
If Target.Address = "$A$1" Then
Set rTriggerCell = Target
Application.EnableEvents = True
On Error GoTo 0
Exit Sub
End If
If Not rTriggerCell Is Nothing Then 'They are leaving A1
MsgBox "You just left cell A1", vbInformation, "OzGrid.com"
Set rTriggerCell = Nothing
End If
Application.EnableEvents = True
On Error GoTo 0
End Su