forensic93
New Member
- Joined
- Jan 14, 2020
- Messages
- 16
- Office Version
- 2016
- Platform
- Windows
Hi,
I was wondering if it was possible to back fill data using a macro?
I have one column where every 4th cell there is data, and one column where every 16th cell there is data.
Essentially i want to know if i can get a macro to read the 4th cell and if the 5th cell has nothing then write what the 4th cell has in it. But if there is data, then that becomes the new number used to fill in empty cells if that makes sense.
Is this possible to do? I have added my attempted code below.
I was wondering if it was possible to back fill data using a macro?
I have one column where every 4th cell there is data, and one column where every 16th cell there is data.
Essentially i want to know if i can get a macro to read the 4th cell and if the 5th cell has nothing then write what the 4th cell has in it. But if there is data, then that becomes the new number used to fill in empty cells if that makes sense.
Is this possible to do? I have added my attempted code below.
VBA Code:
Sub fill_cell()
Dim rw As Long
Dim Sheet As interger
Sheet = 1
With Sheets("Sheet")
for rw = 1 To Cells(Rows.Count, "B").End(xlUp).Row
If Cells(rw, "E") = "" Then Cells(rw, "E") = Cells(rw, "E4")
Next rw
End With
End Sub