![]() |
Setting the print area
Once again I am frustrated by the almost useless Excel VBA programming help.
Why does such a large commercial program have such crappy help? I had better programming help back in the days of programming on the Atari ST! I need a way to set the print area where I know the starting and ending columns and rows. The only example the help gives is for the 'CurrentRegion.' There is no current region set, nor do I want to force the user to make one. I would prefer being able to use column and row numbers as opposed to the A1:G20 method. One would think this would be a simple thing, but here I am. Any help will be appreciated. -Steve |
Setting the print area
Hello
Dim lastcol&, lastrow& With Worksheets("Feuil1") lastcol = .Range("IV1").End(xlToLeft).Column lastrow = .Range("A65536").End(xlUp).Row ..PageSetup.PrintArea = Range("A1", Cells(lastrow, lastcol)).Address End With HTH Cordially Pascal "Patch61" a écrit dans le message de news: ... Once again I am frustrated by the almost useless Excel VBA programming help. Why does such a large commercial program have such crappy help? I had better programming help back in the days of programming on the Atari ST! I need a way to set the print area where I know the starting and ending columns and rows. The only example the help gives is for the 'CurrentRegion.' There is no current region set, nor do I want to force the user to make one. I would prefer being able to use column and row numbers as opposed to the A1:G20 method. One would think this would be a simple thing, but here I am. Any help will be appreciated. -Steve |
Setting the print area
startcol = 1 startrow = 3 endcol = 9 endrow = 25 With Activesheet .PageSetup.PrintArea = .Range(.Cells(startRow,StartCol), _ .Cells(EndRow,EndCol)).Address(1,1,xlA1,True) End With -- Regards, Tom Ogilvy "Patch61" wrote: Once again I am frustrated by the almost useless Excel VBA programming help. Why does such a large commercial program have such crappy help? I had better programming help back in the days of programming on the Atari ST! I need a way to set the print area where I know the starting and ending columns and rows. The only example the help gives is for the 'CurrentRegion.' There is no current region set, nor do I want to force the user to make one. I would prefer being able to use column and row numbers as opposed to the A1:G20 method. One would think this would be a simple thing, but here I am. Any help will be appreciated. -Steve |
Setting the print area
If you use the recorder you can get the essential code needed (far easier
than trying to find it in Help!), e.g. ActiveSheet.PageSetup.PrintArea = "A1:J10" However, as you say, R1C1 method can be easier so it needs amendment: Dim myRange As String myRange = "R1C1:R10C10" myRange = Application.ConvertFormula(myRange, xlR1C1, xlA1) ActiveSheet.PageSetup.PrintArea = myRange or (combining it all up): ActiveSheet.PageSetup.PrintArea = Application.ConvertFormula("R1C1:R10C10", xlR1C1, xlA1) "Patch61" wrote: Once again I am frustrated by the almost useless Excel VBA programming help. Why does such a large commercial program have such crappy help? I had better programming help back in the days of programming on the Atari ST! I need a way to set the print area where I know the starting and ending columns and rows. The only example the help gives is for the 'CurrentRegion.' There is no current region set, nor do I want to force the user to make one. I would prefer being able to use column and row numbers as opposed to the A1:G20 method. One would think this would be a simple thing, but here I am. Any help will be appreciated. -Steve |
Setting the print area
Thanks, guys. This is exactly what I needed.
-Steve "Tom Ogilvy" wrote: startcol = 1 startrow = 3 endcol = 9 endrow = 25 With Activesheet .PageSetup.PrintArea = .Range(.Cells(startRow,StartCol), _ .Cells(EndRow,EndCol)).Address(1,1,xlA1,True) End With -- Regards, Tom Ogilvy "Patch61" wrote: Once again I am frustrated by the almost useless Excel VBA programming help. Why does such a large commercial program have such crappy help? I had better programming help back in the days of programming on the Atari ST! I need a way to set the print area where I know the starting and ending columns and rows. The only example the help gives is for the 'CurrentRegion.' There is no current region set, nor do I want to force the user to make one. I would prefer being able to use column and row numbers as opposed to the A1:G20 method. One would think this would be a simple thing, but here I am. Any help will be appreciated. -Steve |
Setting the print area
feel better now?
Sub setprintarea() ActiveSheet.PageSetup.PrintArea = _ Range(Cells(4, 4), Cells(12, 8)).Address End Sub -- Don Guillett SalesAid Software "Patch61" wrote in message ... Once again I am frustrated by the almost useless Excel VBA programming help. Why does such a large commercial program have such crappy help? I had better programming help back in the days of programming on the Atari ST! I need a way to set the print area where I know the starting and ending columns and rows. The only example the help gives is for the 'CurrentRegion.' There is no current region set, nor do I want to force the user to make one. I would prefer being able to use column and row numbers as opposed to the A1:G20 method. One would think this would be a simple thing, but here I am. Any help will be appreciated. -Steve |
All times are GMT +1. The time now is 06:51 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com