I've set up a bit of VBA that formats a variable length spreadsheet for printing. The problem is that after the first time it's been run, it throws up an error message 1004 "application defined or object defined error".
This is the code that defines the print_area:
ActiveSheet.Names.Add “Print_Area”, ActiveSheet.Range("A1").Resize(NumRows, 6)
NumRows is a variable that I calculate further up to determine the length of the printed out bit I want to use.
First time I run it, it works fine, after that it throws the 1004 error.
I tried clearing the Print_Area using this code:
On Error Resume Next
ActiveSheet.Names(”Print_Area”).delete
On Error GoTo 0
just before set print area bit, but I still get the error Any clues

Error 1004 setting print_area
kamuixkotori
This should work.
ActiveSheet.PageSetup.PrintArea = ActiveSheet.Range("A1").Resize(NumRows, 6).Address
Captain007
Sorry for the delay in replying - thanks for the advice.
Andy