How would I write a macro to find "Gauranteed" in any cell in Column "B" and
then highlight that row? Also, this would be for an entire workbook.
Assuming column A has all the 'main' data and has no spaces between
data and there is no header row:
sub highlight()
for i = 1 to cells(rows.count, "A").end(xlup).row
if cells(i, "B").value = "Guaranteed" then
Cells(i, 1).Resize(, 2).Interior.ColorIndex = 36
next i
end sub
If there is a header row you just need to change i = 1 to i = 2 so it
starts on the second row instead of the first. If your data is not
'grouped' and there are empty rows between your data, this loop will
stop at the first empty space in column A.
In the passage .Resize(, 2), change the 2 to however many cells to the
right you want highlighted. Currently it is set as 2 so only columns A
and B in the row will be highlighted. Changing it to 5 would highlight
columns A-E, 10 would highlight columns A-J, etc...
Also, you spelled guaranteed wrong in your post. I used the correct
spelling in my coding
This sub would work only on the active sheet, not the entire workbook.
If there are multiple sheets you want this to work on, I'd copy/past
this into a sepearte workbook module with a 'shortcut' key (ctrl+Q is
what I usually use). With the 'macro' workbook in the background and
the sheet you want to modify active you can press your shortcut key
and vioala, rows that meet the criteria will be highlighted.