Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to select range like page setup
Hi All
In the Page setup dialogs, sheet tab, you can select Page Area , Rows to report at top and Columns to repeat at left, by click the icon, allow you select worksheet range. Is this methods can be apply on VBA ? If yes how to apply on vba coding ? moonhk GMT+8 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to select range like page setup
On Nov 19, 8:15 pm, moonhk wrote:
Hi All In the Page setup dialogs, sheet tab, you can select Page Area , Rows to report at top and Columns to repeat at left, by click the icon, allow you select worksheet range. Is this methods can be apply on VBA ? If yes how to apply on vba coding ? moonhk GMT+8 Hello moonhk, This line of code will display the PageSetup Dialog from VBA X = Excel.Application.Dialogs(xlDialogPageSetup).Show Sincerely, Leith Ross |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to select range like page setup
hi,
Try recording a macro where you adjust the page setup as desired, then view & modify the resulting code (see below for an example). This will eliminate the need for any user input which is required when the pagesetup dialog is displayed (see Leith's suggestion). Example code: With ActiveSheet.PageSetup .LeftHeader = "" .CenterHeader = "" .RightHeader = "" .LeftFooter = "" .CenterFooter = "" .RightFooter = "" .LeftMargin = Application.InchesToPoints(0.748031496062992) .RightMargin = Application.InchesToPoints(0.748031496062992) .TopMargin = Application.InchesToPoints(0.984251968503937) .BottomMargin = Application.InchesToPoints(0.984251968503937) .HeaderMargin = Application.InchesToPoints(0.511811023622047) .FooterMargin = Application.InchesToPoints(0.511811023622047) .PrintHeadings = False .PrintGridlines = True .PrintComments = xlPrintNoComments .CenterHorizontally = False .CenterVertically = False .Orientation = xlPortrait .Draft = False .PaperSize = xlPaperA4 .FirstPageNumber = xlAutomatic .Order = xlDownThenOver .BlackAndWhite = False .Zoom = 100 .PrintErrors = xlPrintErrorsDisplayed End With note: a lot of the resulting lines of code can be deleted from the finished code for readability/conciseness. I'd test your recorded code on a copy of work & keep deleting lines of code until you find that the layout changes from what you want, undo your last change & then use that code. hth Rob hth Rob __________________ Rob Brockett NZ Always learning & the best way to learn is to experience... "moonhk" wrote: Hi All In the Page setup dialogs, sheet tab, you can select Page Area , Rows to report at top and Columns to repeat at left, by click the icon, allow you select worksheet range. Is this methods can be apply on VBA ? If yes how to apply on vba coding ? moonhk GMT+8 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to select range like page setup
Dim myRng as range
on error resume next set myrng = application.inputbox(Prompt:="Select a range", type:=8) on error goto 0 if myrng is nothing then 'user hit cancel else msgbox myrng.address(external:=true) end if moonhk wrote: Hi All In the Page setup dialogs, sheet tab, you can select Page Area , Rows to report at top and Columns to repeat at left, by click the icon, allow you select worksheet range. Is this methods can be apply on VBA ? If yes how to apply on vba coding ? moonhk GMT+8 -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to select range like page setup
On 11$B7n(B20$BF|(B, $B2<8a(B8$B;~(B56$BJ,(B, Dave Peterson wrote:
Dim myRng as range on error resume next set myrng = application.inputbox(Prompt:="Select a range", type:=8) on error goto 0 if myrng is nothing then 'user hit cancel else msgbox myrng.address(external:=true) end if moonhk wrote: Hi All In the Page setup dialogs, sheet tab, you can select Page Area , Rows to report at top and Columns to repeat at left, by click the icon, allow you select worksheet range. Is this methods can be apply on VBA ? If yes how to apply on vba coding ? moonhk GMT+8 -- Dave Peterson Thank Dave , You coding tested OK. Thank other also. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Page layout - page setup - items disabled | Excel Discussion (Misc queries) | |||
FORMAT EXCEL WORKBOOK (PAGE SETUP) ALL AT ONCE INSTEAD OF BY PAGE | Excel Discussion (Misc queries) | |||
HOW DO I SETUP A PAGE IN EXCEL TO GIVE TOTALS TO ANOTHER PAGE | Excel Worksheet Functions | |||
Under Page Setup the page option of Ledger - for Office XP | Excel Discussion (Misc queries) | |||
Getting a Select Range class field during a macro setup | Excel Programming |