Hello and thank you for any help.
The task basically involves two cells. C2 with value 6. C4 with value 9.
Task: When C2 is active, it's value should appear in C4 and C4 will also turn yellow.
When C2 is not active, the value in C4 will be 9 and will not be yellow.
The following code partially works.
It does not allow C4 to have a value when C2 is not active. May need to re-write line 3.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim c As Range
Range("C4").ClearContents
If Not Intersect(Target, Range("C2")) Is Nothing Then
For Each c In Intersect(Target, Range("C2"))
If c.Address = ActiveCell.Address Then
Range("C4").Value = c.Value
Exit For
End If
Next c
End If
End Sub
Thank you,
The task basically involves two cells. C2 with value 6. C4 with value 9.
Task: When C2 is active, it's value should appear in C4 and C4 will also turn yellow.
When C2 is not active, the value in C4 will be 9 and will not be yellow.
The following code partially works.
It does not allow C4 to have a value when C2 is not active. May need to re-write line 3.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim c As Range
Range("C4").ClearContents
If Not Intersect(Target, Range("C2")) Is Nothing Then
For Each c In Intersect(Target, Range("C2"))
If c.Address = ActiveCell.Address Then
Range("C4").Value = c.Value
Exit For
End If
Next c
End If
End Sub
Thank you,
Last edited by a moderator: