Hi Everyone,
I would like some help writing a code that will fill in the first cell of the column if that column contains a number.
<tbody>
</tbody>
In the example above, the first cell in the second and third column (Temp and pH) would be filled. Below is my first attempt at writing this code:
Any and all help will be greatly appreciated. Thank you!
I would like some help writing a code that will fill in the first cell of the column if that column contains a number.
Location | Temp | pH | Conductivity |
Sample A | NA | 7.60 | <250 |
Sample B | NA | <7.00 | <250 |
Sample C | 23.20 | NA | <250 |
<tbody>
</tbody>
In the example above, the first cell in the second and third column (Temp and pH) would be filled. Below is my first attempt at writing this code:
Rich (BB code):
Sub NumberinCol ()
Dim lrow As Long
Dim lcol As Long
Dim col As Range
Dim oRange As Range
lrow = Cells(Rows.Count, 1).End(xlUp).Row
lcol = Cells(1, Columns.Count).End(xlToLeft).Column
i = 2
Set oRange = Range(Range("B4"), Cells(lrow, lcol))
For Each col InoRange.Columns
IfoRange.Columns(i).SpecialCells(xlCellTypeConstants, 1).Count > 1 Then
Cells(1,i).ColorIndex = 15
End If
i = i + 1
Next col
End Sub