Re: Macro Inquiry - Beginner Support
I'll adjust the code I posted to try and answer your questions.
Sub HighLight() ' Local Variables Dim rngData As Range, rngTgtCol As Range Dim cell As Range Dim strSearchString As String ' Create range object for data in table ( for this example needs to be Col A ) Set rngData = Worksheets("Sheet1").Range("A2", Worksheets("Sheet1").Range("A65536").End(xlUp)) ' Remove all interior color in data range rngData.Interior.ColorIndex = xlNone ' Now set parameters strSearchString = "WITHIN FOOTPRINT" Set rngTgtCol = Worksheets("Sheet1").Range("E1") ' Search the table of data For Each cell In rngData If instr(cell.Offset(0, rngTgtCol.Column - 1), strSearchString)>0 Then ' The following line highlights cell in Col A cell.Interior.ColorIndex = 3 ' The following highlights from Col A to the last Col with information cell.Range("A1",cell.range("IV1").end(xlToLeft)).Interior.ColorIndex = 3 End If Next cell End Sub
If you wanted to test for a "BLANK" then
The only issue with the above is what if the cell has a BLANK space ( someone who wanted to blank the cell and used the spacebar ) so a better test for a blank cell would be