samuel.nunn
New Member
- Joined
- Feb 22, 2009
- Messages
- 20
I am fairly new to VBA and I'm trying to create an event-handler macro that will:
1) Only apply to cells C7:C65536 (not all the cells in the worksheet)
2) If any value appears in those cells in Column C, it will reference the next column to the right: Column D, which already has number values usually ranging from 1-10 and perform a loop to shade those cells (in Column D) in purple WHILE value in column D is GREATER than the cell we STARTED on.
Thanks!
Sam
1) Only apply to cells C7:C65536 (not all the cells in the worksheet)
2) If any value appears in those cells in Column C, it will reference the next column to the right: Column D, which already has number values usually ranging from 1-10 and perform a loop to shade those cells (in Column D) in purple WHILE value in column D is GREATER than the cell we STARTED on.
Code:
Private Sub Worksheet_SelectionChange(<wbr>ByVal Target As Range)
Range("C7:C65536").Select
Range(ActiveCell.Offset(0, 1)).Select
Do While ActiveCell.Offset(1, 0) > ActiveCell.Value
ActiveCell.FormatConditions(1)<wbr>.Interior.ColorIndex = 39
ActiveCell.Offset(1, 0).Select
Loop
End Sub
Sam