Hello All,
I am using the below script to highlight values of cells in a specific column when they contain #N/A. I recieve an error called "Type Mismatch" on the highlighted line below (in Red).
Sub highlightValues()
Sub highlightValues()
Dim ws As Worksheet
Dim i As Long
Dim lastrow As Long
Set ws = Worksheets("sheet1")
lastrow = ws.Cells(Rows.Count, 1).End(xlUp).Row
For i = 3 To lastrow
If Cells(i, 18).Value = "#N/A" Then
Cells(i, 18).Interior.Color = RGB(256, 256, 256)
Else
Cells(1, 18).Interior.Color = xlNone
End If
Next
End Sub
I am using the below script to highlight values of cells in a specific column when they contain #N/A. I recieve an error called "Type Mismatch" on the highlighted line below (in Red).
Sub highlightValues()
Sub highlightValues()
Dim ws As Worksheet
Dim i As Long
Dim lastrow As Long
Set ws = Worksheets("sheet1")
lastrow = ws.Cells(Rows.Count, 1).End(xlUp).Row
For i = 3 To lastrow
If Cells(i, 18).Value = "#N/A" Then
Cells(i, 18).Interior.Color = RGB(256, 256, 256)
Else
Cells(1, 18).Interior.Color = xlNone
End If
Next
End Sub