![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
Hope I ask this properly.
I have a dummy spreadsheet set up for the quoting Dept. Range for each can be small to all columns and 10000+ rows. I only want to print a specific range lets say B1:F1000. Basically I want to print to the last active cell in F which contains data . Is there coding that will examine a range and determine where the data ends, and I can then set the print area I desire? |
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
The easy way to go is setup the print area as A:F, or B:F and Excel will determine by itself the last used row.
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Mike
Posts: 796
|
ThankJuan, I'll try it.
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: Mike
Posts: 796
|
Here's the code I used to set the print area for what I thought would work. It didn't. IT set the print area for all of A and all og G. I was hoping it would find the last cell in the last row that contained data.
Which in my trial run was G48. Code: Application.Goto Reference:="R1C1" ActiveCell.Range("A:G").Select ActiveSheet.PageSetup.PrintArea = "$A:$G" ActiveCell.Select What did I do wrong? _________________ [ This Message was edited by: Zac on 2002-02-21 08:36 ] |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Location: Georgia USA
Posts: 544
|
I think Juan was talking about going to file,page setup and seting the print area to A:F, not using a marco. Hope this helps
|
|
|
|
|
|
#6 |
|
New Member
Join Date: Feb 2002
Location: Washington State
Posts: 33
|
Sub setprintarea()
Dim myrange As String myrange = Cells(Rows.Count, 6).End(xlUp).Address ActiveSheet.PageSetup.PrintArea = "$A$1:" & myrange End Sub This looks for the last used cell in the F column and sets the print area accordingly. Rick |
|
|
|
|
|
#7 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
Quote:
Try the macro proposed, that should work. |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|