Hello Excel Experts,
I need help in updating my macro. The workbook's 2nd worksheet has a formula on Row 2 which needs to be copied down depending on the data availability on the 1st worksheet. The 2nd worksheet is the source of the pivot table on the 3rd worksheet which is then refreshed after all the formulas on 2nd worksheet are copied. This 1st worksheet may have 1 row of data or hundreds of rows of data, it would vary...Currently the macro I built to copy rows stops at a certain row.
My question is....is there a way to update this macro to make sure that the rows that get copied on the 2nd worksheet are exactly the same number of rows from the 1st worksheet?
Below is my macro:
--------------------------------------------------------------------------------------------------- Attached is the workbook for your reference. Any assistance you can provide is greatly appreciated.
I need help in updating my macro. The workbook's 2nd worksheet has a formula on Row 2 which needs to be copied down depending on the data availability on the 1st worksheet. The 2nd worksheet is the source of the pivot table on the 3rd worksheet which is then refreshed after all the formulas on 2nd worksheet are copied. This 1st worksheet may have 1 row of data or hundreds of rows of data, it would vary...Currently the macro I built to copy rows stops at a certain row.
My question is....is there a way to update this macro to make sure that the rows that get copied on the 2nd worksheet are exactly the same number of rows from the 1st worksheet?
Below is my macro:
Code:
Sub sbCopyRangeToAnotherSheet()
'Method 1
Sheets("Sheet1").Range("A1:B10").Copy Destination:=Sheets("Sheet2").Range("E1")
'Method 2
'Copy the data
Sheets("Report Data").Range("A1:B10").Copy
'Activate the destination worksheet
Sheets("Sheet2").Activate
'Select the target range
Range("E1").Select
'Paste in the target destination
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
Attachments
Last edited by a moderator: