0

I want to add an additional input box for range printing.

I changed the code from this post to include another input box to determine the number range and to printpreview instead of printing if possible.

So the code asks:

  • How many copies do you want? (e.g. 10)
  • What number do you want to start at? (e.g 50)

Now Excel prints 10 copies numbered 50 -60

Sub PrintCopies_ActiveSheet()

    Dim CopiesCount As Long 
    Dim CopyNumber As Long 
    Dim StartNumber As Integer 

    CopiesCount = Application.InputBox("How many copies?", Type:=1)
    StartNumber = Application.InputBox("Number to start from", Type:=1) 

    For CopyNumber = StartNumber To CopiesCount 
        With ActiveSheet
            .Range("C1") .Value = CopyNumber 
            .PrintPreview
        End With 
    Next CopyNumber 

End Sub 

My question is, how to change the number in Excel each time I print (and for a range)

5
  • I tried to do it myself and failed miserably.
    – elliot
    Jun 25, 2014 at 18:38
  • 1
    Can you edit your post and copy this in there with proper formatting? its not readable this way and that makes troubleshooting a pain. I do spot an issue. You have ActiveSheet .Range("C1").Value =... It contains a space.
    – LPChip
    Jun 25, 2014 at 18:46
  • no, not as a comment. Comments are only one line, no code. Press the edit button below your question
    – LPChip
    Jun 25, 2014 at 18:53
  • I've edited your post now
    – LPChip
    Jun 25, 2014 at 18:59
  • Can you try copy/paste the code I placed in your first post and see if it works? if not, what happens and what doesn't?
    – LPChip
    Jun 25, 2014 at 19:01

0

You must log in to answer this question.

Browse other questions tagged .