Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help with passing values


Hi,

Below is a snippet of code which I found in some Excel forum and I hav
used previously to determine the print range of a list.

For some reason this code does not seem to work anymore and it seems t
have something to do with the passing of arguments??

Any help would be REALLY appreciated!!


Code
-------------------
Sub PrintSchedule()
'This procedure executes when the user clicks the Print Schedule button and print
'previews all the expense schedule.
Dim PrintThis As Range
'Dim sh As Worksheet
frmWait.Show 0
frmWait.Repaint
Worksheets("Expense Schedule").Activate
'Application.ScreenUpdating = False
'Application.ScreenUpdating = True
PrintThis = ActiveSheet.Range("A20:P" & LastRowRange(ActiveSheet)).Address
frmWait.Hide
With Worksheets("Expense Schedule").PageSetup
If .TopMargin < Application.InchesToPoints(0.5) Then
.TopMargin = Application.InchesToPoints(0.5)
End If
.PrintTitleRows = Worksheets("Expense Schedule").Range("A20:A21").Address
.PrintArea = PrintThis
.Orientation = xlLandscape
.CenterHeader = ""
.BlackAndWhite = True
If .CenterHeader < "" Then .CenterHeader = ""
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 100
End With
Worksheets("Expense Schedule").PrintPreview
Worksheets("Help").Activate
Worksheets("Inv Summ").Activate
Range("A1").Select

End Sub
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:P").Find(What:="*", _
After:=sh.Range("A21"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0

End Functio
-------------------

--
Frigid_Digi
-----------------------------------------------------------------------
Frigid_Digit's Profile: http://www.excelforum.com/member.php...fo&userid=2692
View this thread: http://www.excelforum.com/showthread.php?threadid=46782

  #2   Report Post  
Posted to microsoft.public.excel.programming
ste ste is offline
external usenet poster
 
Posts: 6
Default Please help with passing values

hi, try this:

Sub PrintSchedule()
'This procedure executes when the user clicks the Print Schedule
button and print
'previews all the expense schedule.

Dim PrintThis As Range
'Dim sh As Worksheet
frmWait.Show 0
frmWait.Repaint
Worksheets("Expense Schedule").Activate
'Application.ScreenUpdating = False
'Application.ScreenUpdating = True

'PrintThis = ActiveSheet.Range("A20:P" &
LastRowRange(ActiveSheet)).Address
Set PrintThis = ActiveSheet.Range("A20:P" & LastRowRange(ActiveSheet))
'<

frmWait.Hide
With Worksheets("Expense Schedule").PageSetup
If .TopMargin < Application.InchesToPoints(0.5) Then
.TopMargin = Application.InchesToPoints(0.5)
End If
.PrintTitleRows = Worksheets("Expense
Schedule").Range("A20:A21").Address

..PrintArea = PrintThis.Address '<

.Orientation = xlLandscape
.CenterHeader = ""
.BlackAndWhite = True
If .CenterHeader < "" Then .CenterHeader = ""
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 100
End With
Worksheets("Expense Schedule").PrintPreview
Worksheets("Help").Activate
Worksheets("Inv Summ").Activate
Range("A1").Select


End Sub




'Function LastRowRange(sh As Worksheet)
Function LastRowRange(sh As Worksheet) As Long '<
'This function determines the active print
'range for a list and returns a range object.

'On Error Resume Next
' LastRowRange = sh.Range("A:P").Find(What:="*", _
After:=sh.Range("A21"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False) .Row


LastRowRange =
Range("P20").CurrentRegion.SpecialCells(xlCellType LastCell).Row


'On Error GoTo 0


End Function



Regards,
ste

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help with passing values


Thanks for the response!


--
Frigid_Digit
------------------------------------------------------------------------
Frigid_Digit's Profile: http://www.excelforum.com/member.php...o&userid=26921
View this thread: http://www.excelforum.com/showthread...hreadid=467827

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
Passing Values Information Hog[_6_] Excel Programming 6 August 23rd 05 04:06 PM
PAssing Values to Excel Kevan Hughes Excel Programming 0 March 30th 05 06:09 PM
Passing values to new app BrianG[_4_] Excel Programming 3 May 27th 04 01:58 PM
Passing values between 2 subs ? [email protected] Excel Programming 1 November 21st 03 05:56 PM
passing values from one sheet to another BubBob[_2_] Excel Programming 1 September 4th 03 01:09 PM


All times are GMT +1. The time now is 01:44 AM.

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"