Skip to content

Instantly share code, notes, and snippets.

@irwinwilliams
Created May 1, 2017 11:58
Show Gist options
  • Save irwinwilliams/3ba02698a964d615df34b7af81585f63 to your computer and use it in GitHub Desktop.
Save irwinwilliams/3ba02698a964d615df34b7af81585f63 to your computer and use it in GitHub Desktop.
Needed to update rows in an excel document for a project called Time For Water, based on data @wasatnt released.
Sub FillRows()
For i = 1 To ThisWorkbook.Sheets.Count
Sheets(i).Activate
'You can add more code
With ActiveSheet
Dim lRow As Long
Dim lCol As Long
lRow = Cells(Rows.Count, 3).End(xlUp).Row
lCol = Cells(1, Columns.Count).End(xlToLeft).Column
For j = 2 To lRow
For k = 1 To lCol
With Cells(j, k)
If (.Value = "") Then
.Value = Cells(j - 1, k).Value
'Debug.Print .Value
'Debug.Print i & ": " & j & " - " & k & " > " & lRow
End If
End With
Next k
Next j
End With
Next i
Debug.Print "done, bro"
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment