|
-
Oct 3rd, 2004, 05:58 AM
#1
Thread Starter
New Member
Printing pages in Excel
This one's more Excel's than VBA, but let's see if anyone's here can help me.
On a Worksheet, I want to print columns 1,2 and 3 (A,B and C) side to side with columns 15,16 and 17 (O,P and Q). I can freeze a pane that includes column 1,2 and 3, or I can use the vertical division box that fits well for working. But when it comes to print, the print preview separates it in 2 different pages.
How can I print it in a single page? Perhaps it's very simple, but It's the first time I need to do this and I can't figure it out.
Thank's in advance
-
Oct 3rd, 2004, 01:04 PM
#2
You will probably need some version of this to set the print area
to what you want.
VB Code:
Worksheets("Sheet1").PageSetup.PrintArea = "$A$1:$C$10"
And this will be to clear the print area and make it the whole sheet.
VB Code:
Worksheets("Sheet1").PageSetup.PrintArea = ""
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 3rd, 2004, 05:55 PM
#3
Thread Starter
New Member
Right. But is there another way of working with x,y (user choosen) rather than fixed numbers r1c1?
-
Oct 3rd, 2004, 07:24 PM
#4
What version of Excel are you using? In 2003 you can use the
menu item File > Print Area > Set Print Area
This is the user choosen method.
Or you can program it in a column range allowing the user to
enter the columns or even allow them to enter a range. Just
make sure that if you want columns that are not contiguous then
add a comma between the ranges.
VB Code:
Public Sub PrintMe()
Worksheets("Sheet1").PageSetup.PrintArea = "$A:$C[color=red],[/color]$O:$Q"
End Sub
If you want to prompt the user instead of using the set print area
menu item, then use an inputbox and set the area to a range
variable.
HTH
VB/Outlook Guru!
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|