Results 1 to 4 of 4

New to Macros, having issue with print macro

Threaded View

RansomDE New to Macros, having issue... 10-29-2019, 02:03 PM
Greg M Re: New to Macros, having... 10-29-2019, 02:57 PM
RansomDE Re: New to Macros, having... 10-29-2019, 04:56 PM
Greg M Re: New to Macros, having... 10-29-2019, 06:55 PM
  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.

    Sub CustomPrint()
      Dim lStart As Long, lEnd As Long
      Dim lPrint As Long
    
      lStart = Cells(2, "A").Value
      lEnd = Cells(4, "A").Value
    
      For lPrint = lStart To lEnd
        If lPrint > 99 Then
            [A6] = CStr(lPrint)
        ElseIf lPrint > 9 Then
            [A6] = "0" & CStr(lPrint)
        Else
            [A6] = "00" & CStr(lPrint)
        End If
        Sheets("Traveler").PrintOut
      Next lPrint
    
    End Sub
    Last edited by RansomDE; 10-29-2019 at 02:07 PM.

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