CaptainGravyBum
Board Regular
- Joined
- Dec 1, 2023
- Messages
- 77
- Office Version
- 365
- Platform
- Windows
Hello,
I have a spreadsheet which is populated by copying from an external sheet. The first column only has data in the initial row for the series so I've tried to create a macro which loops copying the data down as required and does exactly what I need except when it gets to the end of the rows and doesn't know where to stop. I'm trying to use column b to find the last row because column A doesn't always have data when it comes to the last batch of data.
Also, when I've managed to get this to work, I could use some help figuring out how to remove the rows that containing the total column as they are not required.
Thanks,
Sub Fill_Registrations()
'
' Fill registrations
'
Dim x As Integer
Application.ScreenUpdating = False
NumRows = Range("B1", Range("B1").End(xlDown)).Rows.Count
For x = 1 To NumRows
Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Selection.End(xlDown).Select
Selection.Offset(-1).Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Next
Application.ScreenUpdating = True
End Sub
I have a spreadsheet which is populated by copying from an external sheet. The first column only has data in the initial row for the series so I've tried to create a macro which loops copying the data down as required and does exactly what I need except when it gets to the end of the rows and doesn't know where to stop. I'm trying to use column b to find the last row because column A doesn't always have data when it comes to the last batch of data.
Also, when I've managed to get this to work, I could use some help figuring out how to remove the rows that containing the total column as they are not required.
Thanks,
Sub Fill_Registrations()
'
' Fill registrations
'
Dim x As Integer
Application.ScreenUpdating = False
NumRows = Range("B1", Range("B1").End(xlDown)).Rows.Count
For x = 1 To NumRows
Range("A1").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
Selection.End(xlDown).Select
Selection.Offset(-1).Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Next
Application.ScreenUpdating = True
End Sub