Your name is in this list? It was totally random! Honest!
Yes you are right the first condition tests for the same cell which I agree is wrong. It should be :[VBA]
Private Sub PopulateEmptyCells()
Dim EndRow As Integer
Dim RowLooper As Integer
With ActiveSheet
EndRow = Cells(65536, 1).End(xlUp).Row
For RowLooper = 7 To EndRow
If Cells(RowLooper, 2).Value = "" Or Cells(RowLooper, 3).Value = "" Then
Cells(RowLooper, 1) = Cells((RowLooper - 1), 1).Value
Cells(RowLooper, 2) = Cells((RowLooper - 1), 2).Value
ElseIf Right(Cells(RowLooper, 2), 5) = "Total" And Cells(RowLooper, 3) = "" Then
Cells(RowLooper, 1) = Cells((RowLooper - 1), 1).Value
Cells(RowLooper, 2).Font.FontStyle = "Bold"
ElseIf Cells(RowLooper, 1).Value = "" And Len(Cells(RowLooper, 2)) > 0 Then
Cells(RowLooper, 1) = Cells((RowLooper - 1), 1).Value
ElseIf Right(Cells(RowLooper, 1), 5) = "Total" And Cells(RowLooper, 3) = "" Then
Cells(RowLooper, 1).Font.FontStyle = "Bold"
End If
Next RowLooper
End Sub
[/VBA]
I am trying to look at columns B and C to determine that if one or both are empty then populate/fill with the contents of the cells above. However it gets tricky: If you look at the attachment and the Desired Results tab, there are couple instances in which just column b needs to be populated. My code when executed doesn't capture the right categories. That is, it will overwrite info that should not be.
Incidentally what's your name, xld?