unable to record a print macro

T

TCMUM

I am trying to record a print macro so that I can stick a button onto a
report and assign it to it but keep getting the error message "unable to
record". My print area is dynamic - can I not assign a macro to a dynamic
range?
 
T

TCMUM

I haves set a dynamic print range so that I am only printing rows that have
values input to them and not empty rows - This works fine.

I then want to record a print macro so that the end user can hit a 'print'
button with this macro assigned to it but only get data, not blank pages.
Kind of an idiot proof solution for non-excel users so that they key into
clearly shaded cells, hit print and a report is produced.
 
B

Barb Reinhardt

Try something like this.

Sub PrintRange()
Dim myRange As Range
Dim aWS As Worksheet

Set aWS = ActiveSheet

Set myRange = aWS.Range("myDynamicRange") '<~~change range name as needed

myRange.PrintOut Copies:=1, Preview:=True, Collate:=True

End Sub


--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.
 
B

Barb Reinhardt

FWIW, I recorded a macro to print a selection and modified it from there.

Barb Reinhardt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top