How to copy data after at a fixed cell
Solved/Closed
skprma
Posts
1
Registration date
Tuesday March 29, 2022
Status
Member
Last seen
March 29, 2022
-
Updated on Mar 29, 2022 at 06:56 AM
skprma - Apr 13, 2022 at 11:47 AM
skprma - Apr 13, 2022 at 11:47 AM
Related:
- How to copy data after at a fixed cell
- Tmobile data check - Guide
- Transfer data from one excel worksheet to another automatically - Guide
- Data transmission cable - Guide
- Digital data transmission - Guide
- If a cell has text then return value ✓ - Excel Forum
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
552
Apr 12, 2022 at 12:12 PM
Apr 12, 2022 at 12:12 PM
Hi Skprma,
I noticed that each entry start with a number that increases with each entry. When this number is a single value in column A (to determine the beginning and the end of an entry) AND column A doesn't contain empty cells (to determine the last row used), then you can give the code below a try:
Note that in the code, the source sheet is called 'Sheet1' and the destination sheet is called 'Sheet2'.
Best regards,
Trowa
I noticed that each entry start with a number that increases with each entry. When this number is a single value in column A (to determine the beginning and the end of an entry) AND column A doesn't contain empty cells (to determine the last row used), then you can give the code below a try:
Sub RunMe() Dim lRow, fcRow, lcRow, x, y As Long Sheets("Sheet1").Select lRow = Range("A1").End(xlDown).Row x = 2 y = 2 fcRow = 2 For Each cell In Range("A2:A" & lRow) If cell.Value = x Then lcRow = cell.Row - 1 Rows(fcRow & ":" & lcRow).Copy Sheets("Sheet2").Rows(y) fcRow = cell.Row x = x + 1 y = y + 8 End If Next cell Rows(fcRow & ":" & lRow).Copy Sheets("Sheet2").Rows(y) End Sub
Note that in the code, the source sheet is called 'Sheet1' and the destination sheet is called 'Sheet2'.
Best regards,
Trowa
Apr 13, 2022 at 11:47 AM
This worked perfectly, thanks a ton!