View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Long print ranges in VBA

Hi Tom, I could not find the limit number in the Excel Specifications and
Limits, but by process of elimination it appears that there is a limit to the
number of discontiguous ranges that Excel will accept.

"Tom Joseph" wrote:

I am trying to get VBA to set a long print range. I have been able to get
this to work and set up printing for 22 reports. I would like it to be able
to work for 23-24 reports, but it appears I dont have the VBA
continuation/wrapping code right or it is a VBA limitataion.

I have commented out the 23 and 24 report options, after a number of
attempts at using some kind of continuation syntax.

Can someone please help with this? If this cannot be directly coded,
perhaps there is a workaround.

Thanks.


If n = 22 Then
'Studies = 22
Sheets("Report").Select
Range( _

"C36:U119,C236:U319,C436:U519,C636:U719,C836:U919, C1036:U1119,C1236:U1319,C1436:U1519,C1636:U1719,C1 836:U1919,C2036:U2119,C2236:U2319,C2436:U2519,C263 6:U2719,C2836:U2919,C3036:U3119,C3236:U3319,C3436: U3519,C3636:U3719,C3836:U3919,C4036:U4119,C4236:U4 319" _
).Select
ActiveSheet.PageSetup.PrintArea = _

"C36:U119,C236:U319,C436:U519,C636:U719,C836:U919, C1036:U1119,C1236:U1319,C1436:U1519,C1636:U1719,C1 836:U1919,C2036:U2119,C2236:U2319,C2436:U2519,C263 6:U2719,C2836:U2919,C3036:U3119,C3236:U3319,C3436: U3519,C3636:U3719,C3836:U3919,C4036:U4119,C4236:U4 319"
End If

'If n = 23 Then
'Studies = 23
' Sheets("Report").Select
' Range( _
'
"C36:U119,C236:U319,C436:U519,C636:U719,C836:U919, C1036:U1119,C1236:U1319,C1436:U1519,C1636:U1719,C1 836:U1919,C2036:U2119,C2236:U2319,C2436:U2519,C263 6:U2719,C2836:U2919,C3036:U3119,C3236:U3319,C3436: U3519,C3636:U3719,C3836:U3919,C4036:U4119,C4236:U4 319,C4436:U4519" _
' ).Select
' ActiveSheet.PageSetup.PrintArea = _
'
"C36:U119,C236:U319,C436:U519,C636:U719,C836:U919, C1036:U1119,C1236:U1319,C1436:U1519,C1636:U1719,C1 836:U1919,C2036:U2119,C2236:U2319,C2436:U2519,C263 6:U2719,C2836:U2919,C3036:U3119,C3236:U3319,C3436: U3519,C3636:U3719,C3836:U3919,C4036:U4119,C4236:U4 319,C4436:U4519"
'End If

'If n = 24 Then
'Studies = 24
' Sheets("Report").Select
' Range( _
'
"C36:U119,C236:U319,C436:U519,C636:U719,C836:U919, C1036:U1119,C1236:U1319,C1436:U1519,C1636:U1719,C1 836:U1919,C2036:U2119,C2236:U2319,C2436:U2519,C263 6:U2719,C2836:U2919,C3036:U3119,C3236:U3319,C3436: U3519,C3636:U3719,C3836:U3919,C4036:U4119,C4236:U4 319,C4436:U4519,C4636:U4719" _
' ).Select
' ActiveSheet.PageSetup.PrintArea = _
'
"C36:U119,C236:U319,C436:U519,C636:U719,C836:U919, C1036:U1119,C1236:U1319,C1436:U1519,C1636:U1719,C1 836:U1919,C2036:U2119,C2236:U2319,C2436:U2519,C263 6:U2719,C2836:U2919,C3036:U3119,C3236:U3319,C3436: U3519,C3636:U3719,C3836:U3919,C4036:U4119,C4236:U4 319,C4436:U4519,C4636:U4719"
'End If