+ Reply to Thread
Results 1 to 6 of 6

process :Run macro on multiple sheets at once, not one after another

  1. #1
    Registered User
    Join Date
    10-11-2008
    Location
    Bangkok
    Posts
    1

    process :Run macro on multiple sheets at once, not one after another

    Dear all,

    I would like to create macro for Page setup function by process all sheets in one time, not one after another too. I think this code nearly close with my problem. However, my worksheet name is not sheet1, sheet2 and sheet3. They have specific name in each worksheet. Could you give me VB code, please?
    http://www.excelforum.com/excel-prog...r-another.html
    Last edited by VBA Noob; 10-11-2008 at 07:15 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862
    This should do it ...
    Please Login or Register  to view this content.
    If you want to set other setup parameters, record a macro while doing what you want on one of the sheets and cut & paste that into the bit above within the "with / end with" lines ... Hope that helps. MM.
    MatrixMan.
    --------------------------------------
    If this - or any - reply helps you, remember to say thanks by clicking on *Add Reputation.
    If your issue is now resolved, remember to mark as solved - click Thread Tools at top right of thread.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    This code doesn't select the sheets, just does the Page Setup, thus it should run faster

    Option Explicit
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862
    I realise the alternative code is more efficient, but the question was how to do this without selecting the sheets one at a time ... not that I understand what the reason for such a request might be But there you go - two options for you ..

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    The code I posted does not actually Select the sheets, it loops through them without and sets the PageSetup Surely this line actually selects the sheet?

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862
    Yep - you're right; I was trying to not loop through the sheets at all, but in creating the array, I've done that anyway ... point conceded

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Create a dynamic list from multiple sheets
    By shbiskup in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-28-2022, 04:04 AM
  2. Macro to loop through all sheets
    By erock24 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-12-2007, 11:57 AM
  3. prevent write to multiple sheets in shared work book
    By martindwilson in forum Excel General
    Replies: 0
    Last Post: 09-13-2007, 07:00 AM
  4. Searching multiple columns on multiple sheets
    By jonhunt in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-18-2007, 12:25 PM
  5. Rearranging order of multiple sheets for printing?
    By fastbiker in forum Excel General
    Replies: 2
    Last Post: 09-23-2006, 09:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1