Sub BondsMod()
Dim Nedas
Dim nedaCol As Range
Dim costCol As Range
Dim i As Long, j As Long
Dim costR As String
Dim costY As String
Dim costYe As String
Dim LastRow As Long
Dim LastCol As Long
Dim WS As Worksheet
'Setting variables for modifcations
Set WS = ActiveSheet
LastRow = WS.Range("A" & Rows.Count).End(xlUp).Row
LastCol = WS.Cells(1, Columns.Count).End(xlToLeft).Column
costY = "$5,000.00"
costYe = "$9,999.99"
costR = "$10,000.00"
Set nedaCol = WS.Range("A1").EntireRow.Find("Neda")
Set costCol = WS.Range("A1").EntireRow.Find("(Bond Qty)")
'This will check to verify required columns exist
If nedaCol Is Nothing Then
MsgBox ("The header ""Neda"" was not found, program will stop.")
Exit Sub
End If
If costCol Is Nothing Then
MsgBox ("The header ""Extended Cost (Bond Qty)"" was not found, program will stop.")
Exit Sub
End If
For i = 2 To LastRow
'if the cost column exists and the value is between 5000 and 9999 we highlight the row yellow, if the value is greater than 9999 we highlight the row red
If WS.Cells(i, costCol.Column).Value >= costY And WS.Cells(i, costCol.Column).Value <= costYe Then
WS.Range(Cells(i, 1), Cells(i, LastCol)).Interior.Color = RGB(0, 0, 0)
End If
If Not nedaCol Is Nothing Then
'if Neda column exists and the array of Nedas contains the one in the column, then we make the row red
Nedas = Array("1037", "1755", "1077", "2596", "2406", "2589", "2587", "5596", "5401", "5403", "5559", "7401", "7650", "7447", "7501", "7433", "6733", "6484", "7432", "9183")
If UBound(Filter(statuses, WS.Cells(i, nedaCol.Column).Value)) > -1 Then
WS.Range(Cells(i, 1), Cells(i, LastCol)).Interior.Color = RGB(255, 0, 0)
End If
Next i
End Sub
I was trying to practice with some things I learned from on of the forum experts but im not sure why im getting this error (or if the variables I have set for cost will work) trying o have it search for currency values
Bookmarks