+ Reply to Thread
Results 1 to 13 of 13

Print macro

  1. #1
    Registered User
    Join Date
    09-05-2008
    Location
    uk
    Posts
    7

    Print macro

    HI
    i have a sheet with a simple database with one row per item. i have a sheet formatted as a certificate. from the data base sheet i wish to select a cell and copy the info into a cell on the certificate then select another cell on the same row on the data sheet and copy to a cell on certificate sheet. so on data sheet cell a2 would be copied to cell j7 on cert sheet. b2 on data sheet to c7 and e2 to g7. then print the cert. next go back to data sheet and repeat for the next row until it reaches a empty row. so basically im printing a cert for each row of the data base. ive named the data sheet DATA and the certificate sheet CERT i was going to use a simple macro via a shortcut key.

  2. #2
    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 macro

    So, on the DATA sheet, we'll start at row2 and move down, yes?

    Try this:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 01-24-2010 at 09:37 AM.
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    09-05-2008
    Location
    uk
    Posts
    7

    Re: Print macro

    hi
    the debugger stops the process on the sub printcerts() i cut and paste ur code as sent into a shortcut key macro.

  4. #4
    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 macro

    The debugger highlights which line of code?

    It would quickest if I could just look at your sheet with the macro installed and behaving unexpectedly. Click GO ADVANCED and use the paperclip icon to post up your workbook with some sample data still in it.

  5. #5
    Registered User
    Join Date
    09-05-2008
    Location
    uk
    Posts
    7

    Re: Print macro

    hi
    this should be it
    Attached Files Attached Files

  6. #6
    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 macro

    I've highlighted some code above...these appear to be missing from your copy/paste. Recopy the code into your sheet.

  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 macro

    I can't see why you need VBA, this could be done with VLOOKUP
    Attached Files Attached Files
    Hope that helps.

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

    Free DataBaseForm example

  8. #8
    Registered User
    Join Date
    09-05-2008
    Location
    uk
    Posts
    7

    Re: Print macro

    sorry my fault redone but still fails
    Attached Files Attached Files

  9. #9
    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 macro

    Actually, it does work for me as far as cycling through and printing all the individual sheets...but your merged cells cause the final line of code to fail. So change that to:

    Please Login or Register  to view this content.
    ...should be good to go from there.

  10. #10
    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 macro

    Quote Originally Posted by royUK View Post
    I can't see why you need VBA, this could be done with VLOOKUP
    VBA is required to put the values in the correct cells at the top of the form and print, then repeat ad nauseum for all the values listed on the DATA sheet all in one step.

  11. #11
    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 macro

    If it's the SHORTCUT you're trying to get added...

    1) Press ALT-F8 from the main worksheet
    2) Click once on the macro
    3) Click on OPTIONS
    4) Put in the shortcut key

  12. #12
    Registered User
    Join Date
    09-05-2008
    Location
    uk
    Posts
    7

    Re: Print macro

    hi
    sorry for delay in replying my excel crashed. it was the shortcut id done wrong.
    now i can see how the code works its so much easier.
    thanks for bearing with me.

  13. #13
    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 macro

    If that takes care of your need, be sure to EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].

    (Also, use the blue "scales" icon in our posts to leave Reputation Feedback, it is appreciated. It is found across from the "time" in each of our posts.)

+ 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