+ Reply to Thread
Results 1 to 8 of 8

Automatic Print list VBA

  1. #1
    Registered User
    Join Date
    08-13-2015
    Location
    Portsmouth, UK
    MS-Off Ver
    2010, 2013
    Posts
    44

    Automatic Print list VBA

    I have written the below code and it all works bar one bit! The range on the form is I10:R12, and when I put this in, rather than a single cell, it does not like merged cellls. (At present I have just left this in the code as I10). When I run it, this stops as it doesnt like transferring the data from cell C8:d8 on the checks sheet, to the I10:R12 cell on the form page. Due to other information on both pages, I cannot change either cell size.
    Please Login or Register  to view this content.
    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. I also recommend using indentation to show the structure. --6StringJazzer
    Last edited by 6StringJazzer; 01-05-2016 at 02:11 PM.

  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: Automatic Print list VBA

    Hello surk,

    Merged cells are referenced using the upper left cell in the merged range. If "I10:R12" is merged as a single cell then you would reference only "I10". If you have 3 rows "I10:R10", "I11:R11", "I12:R12" then the same rule applies.

    Is "C8:D8" also a merged cell?
    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
    Registered User
    Join Date
    08-13-2015
    Location
    Portsmouth, UK
    MS-Off Ver
    2010, 2013
    Posts
    44

    Re: Automatic Print list VBA

    Comes up run time error 1004 - you cannot do that with a merged cell. *Just realised the merged cell reference on Form page is H10:q12
    .Cells(i, "C").Copy Sheets("Form").Range("h10")

    The field it looks up the data is on the Checks page, and that merged cell is C8:D8. This goes down for a number of rows, currently finishing in C98:d98 (all merged all the way down.) This can vary from month to month, hence the need for a loop until the blank cell.

    Many thanks

  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: Automatic Print list VBA

    Hello surk,

    Can you post a copy of the workbook? It would make it easier to help you solve this problem.

    Please change or redact any private, confidential, or sensitive information prior to posting.

    How To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.

  5. #5
    Registered User
    Join Date
    08-13-2015
    Location
    Portsmouth, UK
    MS-Off Ver
    2010, 2013
    Posts
    44

    Re: Automatic Print list VBA

    please see attachment- many thanks

    password is forum
    Attached Files Attached Files

  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: Automatic Print list VBA

    Hello surk,

    Thank you for posting the workbook. I am still unclear on what you want to copy. Can you give me an example of what cell H10 would contain?

    Is any data copied to cells H14, V10, and V14 ?

  7. #7
    Registered User
    Join Date
    08-13-2015
    Location
    Portsmouth, UK
    MS-Off Ver
    2010, 2013
    Posts
    44

    Re: Automatic Print list VBA

    Hiya

    What I need is the code adapting so that when you press "Print all forms" where the macro is attached, it will go to Checks1 nd look at the value in C7. It will then copy this name into the merged H10 cell on "Form". It will (on my version) populate everything, and then print. It will then go back to Checks1 sheet and look at the name in C8. It will then copy this into cell H10 on Forms, and autopopulate, and print. This process needs to be repeated until the macro finds the first blank cell in column C on the Checks1 page, and stops the macro.

    If I have the cell as unmerged, all of the code works fine. I am just getting stuck at where it is a merged cell, it does not like it

    The cells mentioned above use a v lookup to populate data based on the value in h10
    Last edited by surk; 01-05-2016 at 06:42 PM.

  8. #8
    Registered User
    Join Date
    08-13-2015
    Location
    Portsmouth, UK
    MS-Off Ver
    2010, 2013
    Posts
    44

    Re: Automatic Print list VBA

    Sorry, the original posted did not work - this works until the error
    Attached Files Attached Files

+ 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. [SOLVED] VBA code to set out page print layout - height automatic
    By Vogelmann in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-03-2013, 03:22 AM
  2. How to name a file name to save/print in pdf automatic like INVOICE+NUMBER?
    By albertc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-13-2012, 12:34 PM
  3. performing automatic print on a label
    By itsmejan24 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-09-2012, 12:23 PM
  4. Automatic Print Setting (or something similiar)
    By arfanvilla in forum Excel General
    Replies: 0
    Last Post: 05-15-2008, 03:25 AM
  5. Print Breaks-Automatic or Force New
    By Tracy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-22-2006, 08:20 PM
  6. automatic printing / print report FIXED
    By neilwebb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2005, 05:05 PM
  7. Replies: 2
    Last Post: 04-06-2005, 08:06 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