Home |
Search |
Today's Posts |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just a thought....
If that lastrowrange subroutine is used for different things, you may not want to change it. That's why I just added 1 to what that subroutine returned. lk wrote: Thanks Rowan, Patrick, Dave and William, Your responses are much appreciated! I decided to go with Rowan's suggestion as it seemed a simple mod to my code and it worked perfectly. I am adding the other suggestions to my Excel knowledge base as I'm sure they will come in handy too. Ciao Lawrence "Dave Peterson" wrote in message ... One mo With ActiveSheet .PageSetup.PrintArea = "" .PageSetup.PrintArea = ActiveSheet.Range("A1:Q" & _ LastRowRange(ActiveSheet) + 1).Address End With lk wrote: Hi all, I have the code below (kindly provided by a genius from this forum) that determines the active print range for a sheet. It works perfectly, however, I wish to expand this returned range by 1 row. I have experimented with offset but so far have had no success. Any ideas would be welcomed! With ActiveSheet .PageSetup.PrintArea = "" .PageSetup.PrintArea = ActiveSheet.Range("A1:Q" & LastRowRange(ActiveSheet)).Address End With Function LastRowRange(sh As Worksheet) 'This function determines the active print range for a list and returns a range object. On Error Resume Next LastRowRange = sh.Range("A:A").Find(What:="*", _ After:=sh.Range("A1"), _ Lookat:=xlPart, _ LookIn:=xlFormulas, _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, _ MatchCase:=False).Row On Error GoTo 0 End Function -- Dave Peterson -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul | Excel Worksheet Functions | |||
SUM() and OFFSET() CAUSES #VALUE | Excel Worksheet Functions | |||
Offset help | Excel Discussion (Misc queries) | |||
Problem with Range.Cells.Offset and Range.Cells( row + offset, column) | Excel Programming | |||
Offset.Value | Excel Programming |