Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default 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
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
Page layout - page setup - items disabled Bill D - Hubbard & Co Excel Discussion (Misc queries) 6 February 2nd 10 04:34 PM
FORMAT EXCEL WORKBOOK (PAGE SETUP) ALL AT ONCE INSTEAD OF BY PAGE fred Excel Discussion (Misc queries) 1 August 11th 08 04:54 PM
HOW DO I SETUP A PAGE IN EXCEL TO GIVE TOTALS TO ANOTHER PAGE Randy Excel Worksheet Functions 1 February 8th 07 06:15 PM
Under Page Setup the page option of Ledger - for Office XP Turbo Excel Discussion (Misc queries) 2 September 27th 06 02:46 AM
Getting a Select Range class field during a macro setup ssciarrino Excel Programming 1 August 22nd 05 06:15 PM


All times are GMT +1. The time now is 02:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"