Hi I have an excel macro question in VBA. I have this code. I want it to go down each cell in row C and run the same if statement instead of just depending on cell C2. I want it to continue to C3, C4, C5, all the way till the end of the sheet. Can anyone help me solve this?
Sub Macro1()
Dim lngLastRow As Long
lngLastRow = Cells(Rows.Count, "A").End(xlUp).Row
If IsEmpty(Range("C2")) Then
Range("E2:E" & lngLastRow).Formula = "=B2 & ""_"" & C2"
Else
Range("E2:E" & lngLastRow).Formula = "=B2"
End If
End Sub