Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / July 2006

Tip: Looking for answers? Try searching our database.

Select Range to last used cell

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jules - 04 Jul 2006 16:21 GMT
In a macro I need to select an Range of cells (rows and columns) for
printing

The data in the spreadsheet is brought in via a database query and so
the bottom area has lots of blank rows, and a print page ends up with
half dozen blank pages.

Each time the data is refreshed there is going to be more or less rows,
so I cannot choose a specific range.

I've tried Special Cells Last Cell but it goes to the end of the blank
rows
   Selection.SpecialCells(xlCellTypeLastCell).Select

Can't use Special Cells Blanks as there are couple in the data itself

I've tried selecting the area and then printng the selection but only
get 2 cells
   Range(Selection, Selection.End(xlToRight)).Select
   Range(Selection, Selection.End(xlDown)).Select
  ActiveWindow.Selection.PrintOut copies:=1
Any ideas?
Don Guillett - 04 Jul 2006 17:14 GMT
one way
Sub getprintarea()
fr = ActiveCell.Row
fc = ActiveCell.Column
lr = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row
lc = Cells(ActiveCell.Row, Columns.Count).End(xlToLeft).Column
Range(Cells(fr, fc), Cells(lr, lc)).PrintOut
End Sub

Signature

Don Guillett
SalesAid Software
dguillett1@austin.rr.com

> In a macro I need to select an Range of cells (rows and columns) for
> printing
[quoted text clipped - 18 lines]
>   ActiveWindow.Selection.PrintOut copies:=1
> Any ideas?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.