I have a pivot table on excel where the first 4 rows are headers and the 1st column is the name of a company.
how do i highlight column1 and the cells in column 2 and 3 if it is not 0?
From
to this
I tried using invoke code to highlight column 2/3 first
Dim wb As Microsoft.Office.Interop.Excel.Workbook
Dim ws As Microsoft.Office.Interop.Excel.Worksheet
Dim excel As Microsoft.Office.Interop.Excel.Application
excel=New Microsoft.Office.Interop.Excel.Applicationclass
wb =excel.Workbooks.Open(filee)
excel.DisplayAlerts= False
ws=CType(wb.Sheets("Sheetssd2"),Microsoft.Office.Interop.Excel.Worksheet)
Dim rcell As microsoft.Office.Interop.Excel.Range
Dim rng As microsoft.Office.Interop.Excel.Range
rng= ws.range("B5:C"+rr)
For Each rcell In rng
If rcell.value <> 0 Then
rcell.font.Color=RGB(255,0,0)
End If
Next
excel.DisplayAlerts=True
wb.Save
wb.close
but it throws me an error
BC32013: Option Strict On disallows operands of type Object for operator ‘<>’. Use the ‘Is’ operator to test for object identity.
And when i replaced <> with isnot, entire cells of column 2 and 3 are changed instead