+ Reply to Thread
Results 1 to 8 of 8

Macro for setting margins

  1. #1
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Macro for setting margins

    hi there. I was wondering if somebody could help with the following problem I have.

    I have x amount of reports (say 10 for example).Each report has 20 tabs. I want to scan these in using Adobe. But I need to reset the margins differently to a predefined specification for each tab.

    Instead of me doing this individually for all the 20 tabs on 10 reports, is it possible to have a macro to do this?

    The tabs are the same in each spreadsheet, but the number of lines going downwards may vary, but horizontally it will always be the same.

    Any help would be appreciated.

    Thanks

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Macro for setting margins

    Hello floricita,

    You didn't provide any margin measurements. All the sheets will have the same margins, yes?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Re: Macro for setting margins

    Hi there.

    Sorry we're working out the measurements, I was just wondering if I can add them into a code tomorrow when we decide on them.

    Sorry I didn't make it very clear.

    Basically we're running lots of reporting packs. They have to be sent out to each area manager.

    Each pack will have exactly the same contents within the workbook, but it will be specific for their area. So in that respect, some of the data in the workbooks may be slightly more volumnous vertically than in others.

    Within each spreadsheet there is a multitude of tabs which reflects the table of contents. Each tab shows a different report. Each tab will have different sized margins to the other which we will decide tomrrow. But the margins will be set the same for each spreadsheet.

    Hope that makes sense?

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Macro for setting margins

    Hello floricita,

    Here isan example of how to set each margin using VBA. Each worksheet has its own setup.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Re: Macro for setting margins

    Thanks a lot. i will try this at work tomorrow.

    This may sound stupid, but are the bits to the side that are in inverted commas, annotation or is it part of the code?

    Kind regards

    F

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Macro for setting margins

    Hello floricita,

    The single quotes denote a remark in VBA. Any characters following the mark up to the end of the line marker are ignored when the code is run.

  7. #7
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Re: Macro for setting margins

    Thanks

    So I think that is a macro that will apply margins for one sheet/tab? Is that right?

    And if I wanted to change the setting I just delete where you put .5 and change to say .7???

    And if I wanted to have one ofr the whole worksheet with different settings for each tab, would I just copy that code and just amend the details e.g "sheet1" with the title of tab 2 and change the .5 to say 1.2 etc and carry on like this?

    Thanks again.

  8. #8
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Re: Macro for setting margins

    Ok I tried running the above macro as a test run but I got the error message saying"invalid outside proceedure".

    Not sure what that means though?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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