Set appExcel = CreateObject(“Excel.Application”)
appExcel.visible=true
Set objWorkBook = appExcel.Workbooks.Open (filepath)'opens the sheet
Set objSheet = appExcel.Sheets(“Sheet1″) 'To select particular sheet
With objSheet.UsedRange 'select the used range in particular sheet
Set c = .Find (“nn”)'data to find
For each c in objSheet.UsedRange' Loop through the used range
If c=”nn” then' compare with the expected data
c.Interior.ColorIndex = 40' make the gary color if it finds the data
End If
Set c = .FindNext(c)' next search
Next
End With
objWorkBook.save
objWorkBook.close
set appExcel=nothing
Comments