storemannequin
Board Regular
- Joined
- May 29, 2010
- Messages
- 108
I'm working on a code to search the first row of a data set for the word "label" and then search in that column for the letter "P", and for each "P" to put the word "This" in a column 2 to the left. This seems simple enough and I've given a crack at it, but the code isn't working properly. Any idea why not?
Sub tryout()
FC = Cells(1, Columns.Count).End(xlToLeft).<wbr>Column
FR = Cells(Rows.Count, 1).End(xlUp).Row
RowCount = FR - 1
For i = 1 To FC
If Cells(1, i).Value = "label" Then
With Cells(1, i).Resize(RowCount, 1)
For j = 1 To FR
If Cells(j, i).Value = "P " Then
Cells(j, i).Offset(, -2).Value = HSI
End If
Next j
End With
Exit For
End If
End Sub