Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
IK IK is offline
external usenet poster
 
Posts: 5
Default 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.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I freeze colums & rows without the windows button? Theresa Excel Discussion (Misc queries) 1 January 6th 06 03:19 AM
How do change rows to colums AND columns to rows Colleen A Excel Discussion (Misc queries) 7 December 30th 05 12:40 AM
Print few rows with many colums so that rows wrap on printed pages usfgradstudent31 Excel Discussion (Misc queries) 1 October 20th 05 02:39 PM
i want my excel colums to be rows peter Excel Worksheet Functions 1 March 29th 05 10:37 PM
switch colums and rows susanne in new jersey New Users to Excel 1 December 22nd 04 08:39 PM


All times are GMT +1. The time now is 01:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"