unable to record a print macro

  • Thread starter Thread starter TCMUM
  • Start date Start date
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?
 
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.
 
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.
 
FWIW, I recorded a macro to print a selection and modified it from there.

Barb Reinhardt
 
Back
Top