jessitarexcel
Board Regular
- Joined
- Apr 6, 2022
- Messages
- 60
- Office Version
- 365
- Platform
- Windows
- Mobile
- Web
Hello,
I currently have over 300 rows of data. The data that I want to copy is below and has been de-identified. The data that needs to be copied is in the yellow cells in rows 2,4,6,8, etc. The data needs to be copied from above and copied in to the blank (orange) row below.
This needs to occur for every second row.
I am currently looking at two pieces of code that I have taken from this website on another topic:
Can someone please explain to me what the "i" and the "j" refer to in this code please? I believe Bill was the original person who wrote the code.
And the following code:
Can someone please explain to me what the Resize(5,4) means? Does that mean that it moves down 5 rows and across 4 columns?
Any help would be very much appreciated.
I currently have over 300 rows of data. The data that I want to copy is below and has been de-identified. The data that needs to be copied is in the yellow cells in rows 2,4,6,8, etc. The data needs to be copied from above and copied in to the blank (orange) row below.
This needs to occur for every second row.
I am currently looking at two pieces of code that I have taken from this website on another topic:
VBA Code:
Sub CopyDown()
lastRow = Range("A" & Rows.Count).End(xlUp).Row + 4
i = 1
j = 5
While i < lastRow
Sheets(1).Range("A" & i & ":D" & i).Copy Sheets(1).Range("A" & i & ":D" & j)
i = i + 5
j = j + 5
Wend
End Sub
Can someone please explain to me what the "i" and the "j" refer to in this code please? I believe Bill was the original person who wrote the code.
And the following code:
VBA Code:
Sub CopyDown()
Dim UsdRws As Long
Dim Cnt As Long
UsdRws = Range("A" & Rows.Count).End(xlUp).Offset(4).Row
For Cnt = 1 To UsdRws Step 5
Range("A" & Cnt).Resize(5, 4).FillDown
Next Cnt
End Sub
Can someone please explain to me what the Resize(5,4) means? Does that mean that it moves down 5 rows and across 4 columns?
Any help would be very much appreciated.