Hello all!
Okay, I have a template for another department I am developing. I need to add some conditional formatting via VBA. I managed to find a code on the forums and modified it. It meets one of my two requirements as is, but there is 1 change I would like (the range). I just either need a second code or modification to this code. I am still very new to Worksheet_Change coding. The code I found as works for "part 2 is below"
Part 1 - Any NEW entry will require the entire row to be highlighted (I recommend in either orange or yellow... no preference).
- The range of the data is columns A - DD
- The number of rows will vary from week to week as this is a global workbook (so I would rather not be required to list a specific range)
- The key cell that would indicate an entry is in column C, this is where the employee ID is located.
- For example, right now I have 1377 rows of data
- If I add something to cell A1378 or B1378, my "Part 2" VBA would kick in and highlight the cell (color #38) pink or whatever it is. If data was entered into cell C1378, then the entire row (A1378:DD1378) would be highlighted in yellow (or orange).
- I want the "add" script to run initially
- Many of these cells are formulas within the other columns, it is likely that another cell within the range of AA:DD although the row was added may require the user to overwrite it.
- In this instance, the row would be yellow (or orange) to indicate it was an added row, but then it may also contain some lpink cells to indicate cells overwritten
Part2 - Individual cells are chnged to pink (color #38) when changed.
- In the second line of the code, I would love it if the range is not limited
- This process is growing substantially
- The bi-weekly payroll has in excell of 25,000 rows
- The range can be based on whether the row has a value in column C
- Column C is the employee ID, which is the driving force behind all transactions
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A2:DD2500"
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Interior.ColorIndex = 38
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
Display More