Hi,
I have a simple macro to copy-paste formula over a range of active rows. I've used Dim statement to identify the last active row using worksheet countA function. And then written statements to copy formula from a specific location and paste in a specific cell for the active number of rows.
Dim LastRow as long
LastRow WorksheetFunction.CountA(Sheet1.Range("A:A")) + 2 {I need the +2 as there are blank rows at the top of the report that need to be counted in the total number of active rows}
Sheet1.activate
Range("A2:F2").Select {A2 to F2 have vlookup formula}
Selection.Copy
Range("Q5:AH" & LastRow).PasteSpecial
When I click the button to run the macro, it will run for a partial range. For example if the report is 32,500 rows long, formula will be pasted into 15,000 rows. However when I step in to debug the paste function will be applied to the entire range of 32,500 rows.
What may be going wrong?
I have a simple macro to copy-paste formula over a range of active rows. I've used Dim statement to identify the last active row using worksheet countA function. And then written statements to copy formula from a specific location and paste in a specific cell for the active number of rows.
Dim LastRow as long
LastRow WorksheetFunction.CountA(Sheet1.Range("A:A")) + 2 {I need the +2 as there are blank rows at the top of the report that need to be counted in the total number of active rows}
Sheet1.activate
Range("A2:F2").Select {A2 to F2 have vlookup formula}
Selection.Copy
Range("Q5:AH" & LastRow).PasteSpecial
When I click the button to run the macro, it will run for a partial range. For example if the report is 32,500 rows long, formula will be pasted into 15,000 rows. However when I step in to debug the paste function will be applied to the entire range of 32,500 rows.
What may be going wrong?