• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 46
  • Last Modified:

Create a macro to print two copies changing a data validation list on 2nd copy

I want to create a macro that will print two copies of a worksheet.
The first print will be the "white copy" I'm using a data validation list to select White Copy, and the second print will be the "yellow copy" which is the other option in the list. When I record the macro and make the selection it does not recognize the selection change in the list. How do I get it to recognize the selection and print according to it?

I got it to work, but it is now giving me a runtime error 1004
Here is what I'm using"

Sub Printer()
'
' Printer Macro
'

'
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
        IgnorePrintAreas:=False
     Range("I5:K5").Value = Split(Range("I5").Validation.Formula1, ",")(1)
   
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
        IgnorePrintAreas:=False
     Range("I5:k5").Value = Range(Range("I5:k5").Validation.Formula1)(2)
End Sub

Can you tell me what I'm doing wrong?
0
Elania Rodriguez
Asked:
Elania Rodriguez
  • 3
1 Solution
 
Rgonzo1971Commented:
Hi,

pls try
Sub Printer()
'
' Printer Macro
'

'
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
        IgnorePrintAreas:=False
     Range("I5:K5").Value = Split(Range("I5").Validation.Formula1, ",")(1)
    
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
        IgnorePrintAreas:=False
     Range("I5:k5").Value = Split(Range("I5").Validation.Formula1, ",")(2)
End Sub

Open in new window

Regards
0
 
Elania RodriguezAuthor Commented:
Run-time error '9';
Subscript out of range

It did work but with an error
0
 
Rgonzo1971Commented:
Could you send a dummy?
0
 
Rgonzo1971Commented:
A solution according to author's comment
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now