rjplante
Well-known Member
- Joined
- Oct 31, 2008
- Messages
- 558
- Office Version
- 365
- Platform
- Windows
I have a large spreadsheet and I have a macro in the worksheet to color the active row and column. I have figured out how to restrict the color application on the columns. When I select a cell, the row is highlighted from column A to column DP. However I cannot figure out how to restrict the rows in a specific column from 1 to 150 to be highlighted. I have my macro code pasted below. How can I restrict the number of rows highlighted in a particular column?
Thanks for the Help.
VBA Code:
Dim MyRow As Integer
Dim MyCol As Integer
MyRow = ActiveCell.Row
MyCol = ActiveCell.Column
If MyCol < 120 And Target.Row < 304 Then
Cells.Interior.ColorIndex = xlColorIndexNone
Range("A" & MyRow & ":DP" & MyRow).Interior.Color = RGB(115, 240, 255)
Target.EntireColumn.Interior.Color = RGB(115, 240, 255)
Target.Interior.ColorIndex = xlColorIndexNone
End If
Thanks for the Help.