do the trick? what trick?
your code makes 4 errors:
1: it will NEVER print more then 4 columns
2, it uses select where it needn't
3: it uses a lastrow variable which isn't needed either
4: it dims a row number as double????
to print the entire sheet just clear the Printarea:
ActiveSheet.PageSetup.PrintArea = ""
keepITcool
< email : keepitcool chello nl (with @ and .)
< homepage:
http://members.chello.nl/keepitcool
Binzelli wrote:
Frankie,
I assume you want to set the printarea from A1 to the last cell in the
sheet. The code below selects the last cell
(ActiveCell.SpecialCells(xlLastCell).Select) and assigns its rownumber
to the variable Lastrow. (Lastrow = Selection.Row). Then the string
"SelString" defining the range to be selected is made from that
variable (SelString = "A1:D" & Lastrow). This should do the trick.
Code:
--------------------
Sub SetPrintArea
Dim Lastrow As Double
Dim SelString As String
ActiveCell.SpecialCells(xlLastCell).Select
Lastrow = Selection.Row
SelString = "A1:D" & Lastrow
ActiveSheet.PageSetup.PrintArea = SelString
End Sub
--------------------
Good luck
---
Message posted from http://www.ExcelForum.com/