Hi all,
New to this forum. I'm trying to set a print area using a named range where the range is determined by finding a specified value in the rightmost column and then extending to the left and up to the start of the dataset. Not sure how to apply a range name - the following code is failing on Range.Name line. Any help appreciated.
New to this forum. I'm trying to set a print area using a named range where the range is determined by finding a specified value in the rightmost column and then extending to the left and up to the start of the dataset. Not sure how to apply a range name - the following code is failing on Range.Name line. Any help appreciated.
Code:
Sub ExportImpPlan()
'
' ExportImpPlan Macro
'
Application.ScreenUpdating = False
Sheets("Implementation Plan").Select
Range("AC1").Select
'
Cells.Find(What:="0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
'
Range(Selection, Selection.End(xlToLeft)).Select
Range(Selection, Selection.End(xlUp)).Select
Range.Name = "PrintRange"
'
ActiveSheet.PageSetup.PrintArea = PrintRange
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Application.ScreenUpdating = True
End Sub