Printing range of sheets in excel or in PDF
I have following macro which prints from the ranges defined, but if i want to print the same ranges and save them in one excel file as sheets separately. And also if i want to print the same and save as pdf file.
Code:
Sub Print_Ranges()
Dim strShtname As String, strRngName As String
Dim i As Long
With Worksheets("INDEX")
'sort the named range list according to page number order
.Range("A2").CurrentRegion.Sort key1:=Range("A3"), order1:=xlAscending, Header:=xlYes, ordercustom:=1, Orientation:=xlTopToBottom
'loop through the cells and determine parent of named range and specific range addresses
For i = 3 To 38
strRngName = .Cells(i, 2).Text
strShtname = Range(strRngName).Parent.Name
'clear any existing print areas and reset to named ranges areas
With Worksheets(strShtname)
.PageSetup.PrintArea = ""
.PageSetup.PrintArea = Range(strRngName).Address
.PrintOut
' .PrintPreview
End With
Next i
End With
End Sub
Kindly assist.