+ Reply to Thread
Results 1 to 4 of 4

New to Macros, having issue with print macro

  1. #1
    Registered User
    Join Date
    10-29-2019
    Location
    US
    MS-Off Ver
    2019
    Posts
    2

    New to Macros, having issue with print macro

    The following code is simple in theory. I am trying to print a number of sheets, iterating a number from [some start] to [some finish]. Instead of print say 1-10, it will print a a "001" followed by a 9x "002"s. I can't really figure it out, clearly there is something I don't understand about how some of these functions work.

    Please Login or Register  to view this content.
    Last edited by RansomDE; 10-29-2019 at 02:07 PM.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: New to Macros, having issue with print macro

    Hi there,

    See if the following code does what you need:

    Please Login or Register  to view this content.
    You need the ' character at the start of the NumberFormat specification, otherwise Excel will "helpfully" convert the string value with leading zeros to a numeric value without leading zeroes.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    10-29-2019
    Location
    US
    MS-Off Ver
    2019
    Posts
    2

    Re: New to Macros, having issue with print macro

    I Greg,

    Thanks for the help, your code is certainly much more concise. It didn't fix the issue, but it helped me figure it out. The A6 was not located on the same worksheet as "Traveler", so it make A6 = 1, print. Active worksheet would then move to the printed sheet, and it would alter a cell I didn't want it to. As of now, all is working.

    -Ransom

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: New to Macros, having issue with print macro

    Hi again,

    Many thanks for your feedback.

    You're welcome - glad I was able to help.

    Regards,

    Greg M

+ 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] Unlocking Workbook to Print with Macro Issue
    By SLIDE1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2018, 03:17 PM
  2. PRINT ISSUE: Empty Print Preview
    By wedzmer in forum Excel General
    Replies: 1
    Last Post: 06-21-2018, 10:42 AM
  3. Issue With Executing Macros Within Macro, If Statement
    By EnergyHOU in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-23-2016, 02:37 PM
  4. VBA coding issue - new to writing macros please help with automatically running my macro
    By ironmonkey88 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-18-2013, 10:10 AM
  5. Excel 2007 - Print Macro - Infinite Loop Issue
    By Fraenk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2012, 07:50 AM
  6. Macro - Print to PDF issue
    By AlexMach in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-10-2012, 07:47 PM
  7. Personal Macro issue - 2 x macros
    By angel56 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-22-2007, 04:49 AM

Tags for this Thread

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