![]() |
How to copy&paste a variable range rows and colums
I have a formula returning a numerical # (like 25). I want to copy and paste
a range from Column A4 to Column GXX) Using that # number as the quantity of rows that I have go to down. Also the data is going to be selected from another sheet, using that variable range specified in the sheet that the data is going to be pasted. |
How to copy&paste a variable range rows and colums
With no validity checks...
Option Explicit Sub testme01() Dim LastRowToPrint As Long 'what worksheet and cell holds that number LastRowToPrint = Worksheets("sheet1").Range("x99").Value 'what's the worksheet to print? Worksheets("sheet2").Range("A4:G" & LastRowToPrint).PrintOut preview:=True End Sub If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm And I used preview:=true to save some trees while testing. IK wrote: I have a formula returning a numerical # (like 25). I want to copy and paste a range from Column A4 to Column GXX) Using that # number as the quantity of rows that I have go to down. Also the data is going to be selected from another sheet, using that variable range specified in the sheet that the data is going to be pasted. -- Dave Peterson |
All times are GMT +1. The time now is 03:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com