I have the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("W2") <= Range("W1") Then
If Not Intersect(Target, Range("A:U")) Is Nothing Then
Call Automatic_Highlights
Else
End If
End If
End Sub
Which Calls the following:
Sub Automatic_Highlights()
Dim TargetCell As Range
Dim CellReturn As Range
TargetRow = ActiveCell.Row
TargetCol = ActiveCell.Column
ActiveCell.Interior.ColorIndex = 37
Cells(TargetRow, 21).Select
ActiveCell.Interior.ColorIndex = 37
Cells(TargetRow, TargetCol).Select
End Sub
This code functions perfectly except for 1 thing. Imagine you are editing cell A2. When you finish editing cell A2, you click to another cell on the sheet (or even press enter). Sub Automatic_Highlight will then be called for the currently active cell (which will not be cell A2). How do I re-write this for Sub Automatic_Highlight to highlight cell A2 (or whatever cell is being edited, "A2" is just an example)?
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("W2") <= Range("W1") Then
If Not Intersect(Target, Range("A:U")) Is Nothing Then
Call Automatic_Highlights
Else
End If
End If
End Sub
Which Calls the following:
Sub Automatic_Highlights()
Dim TargetCell As Range
Dim CellReturn As Range
TargetRow = ActiveCell.Row
TargetCol = ActiveCell.Column
ActiveCell.Interior.ColorIndex = 37
Cells(TargetRow, 21).Select
ActiveCell.Interior.ColorIndex = 37
Cells(TargetRow, TargetCol).Select
End Sub
This code functions perfectly except for 1 thing. Imagine you are editing cell A2. When you finish editing cell A2, you click to another cell on the sheet (or even press enter). Sub Automatic_Highlight will then be called for the currently active cell (which will not be cell A2). How do I re-write this for Sub Automatic_Highlight to highlight cell A2 (or whatever cell is being edited, "A2" is just an example)?