Closed Thread
Results 1 to 16 of 16

Print Pages by Using Macro

  1. #1
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    Print Pages by Using Macro

    Hi,
    Can anyone tell me what is the code for Macro to print selected sheet and pages based on input number.

    For example :
    in cell A1=1
    When I run the macro, it will print page 1

    in cell A1=2
    When I run the macro, it will print page 2

    A1 is manual typed number to determine which page to print
    Last edited by BlastRanger; 10-20-2010 at 06:30 AM.
    Please give a Reputation as a gift for a thanks.
    By clicking the second icon at the top right corner of a user post or reply

  2. #2
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    Re: Print Pages by Using Macro

    Bump no response

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Print Pages by Using Macro

    Maybe this to print the sheet indexed by the value in cell A1 on the Sheet(1):
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    Re: Print Pages by Using Macro

    Pardon me,
    that seems not working.

    I want a macro for example :
    Print Document Page (A1).

    In A1 when I type 1 (one) then the macro will print current sheet page 1.
    In A1 when I type 2 (two) then will print current sheet page 2.

    That macro you give me seems do nothing. I run the macro but nothing happens (fill the A1 with 1 should print page 1, but nothing happen)
    Last edited by BlastRanger; 10-18-2010 at 03:28 AM.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Print Pages by Using Macro

    Are you taking about Worksheets or pages from one worksheet?
    Hope that helps.

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

    Free DataBaseForm example

  6. #6
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    Re: Print Pages by Using Macro

    Pages from one worksheet.
    Page to print determined by value enter in A1

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Print Pages by Using Macro

    This is untested
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    Re: Print Pages by Using Macro

    Hi,
    I Assign the macro to a button and I put the button in Page 3 of the sheet.
    in A1 I fill 2 and run the macro (should print page 2, but the macro print page 3 instead)

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Print Pages by Using Macro

    Try changing to this
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    Re: Print Pages by Using Macro

    Hi No Luck,
    I fill 1 in A1, but it keep print page 2 when i click the button

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Print Pages by Using Macro

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!

  12. #12
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    Re: Print Pages by Using Macro

    OK see the attachment :S
    Attached Files Attached Files

  13. #13
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Print Pages by Using Macro

    I think this is what you want

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    06-02-2010
    Location
    n.ireland
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: Print Pages by Using Macro

    Sorry for butting in,

    in this line of code
    Please Login or Register  to view this content.
    Why is it (.value and not just value)

    sorry for asking this question but i would like to understand whats the reason for the dot.

    Thanks

  15. #15
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Print Pages by Using Macro

    That reference is found inside of a WITH .... END WITH section. Each those dot references are like an extension of the parent found on the WITH... line, equivalent to:
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor BlastRanger's Avatar
    Join Date
    09-02-2010
    Location
    Indonesia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    238

    Re: Print Pages by Using Macro

    Oh, at last. . .
    Thanks

Closed 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