# Microsoft Office Application Help - Excel Help forum > For Other Platforms(Mac, Google Docs, Mobile OS etc) >  >  Macro for PDFing a selection in Excel for Mac

## harrisonlpp

Hi,

I've recorded a Macro in order to go to a sheet, select some cells and then 'save as' that selection as a PDF.

However, it doesn't seem to work, at first i get this error:

Sub Macro10()
'
' Macro10 Macro
'

'
    Sheets("Sign off Sheet").Select
    ActiveSheet.ChartObjects("Chart 1").Activate
    Range("A1:F48").Select
     "/Users/harrisonpritchard/Desktop/Pricing Sheet HP/2.0//"
     "/Users/harrisonpritchard/Desktop//"
    ActiveWorkbook.SaveAs Filename:= _
        "/Users/harrisonpritchard/Desktop/Test_Copy of Cost Calculator_v3.3.pdf", _
        FileFormat:=xlPDF, PublishOption:=xlSelection
    Sheets("Pricing Sheet").Select
End Sub

the 'users/harrisonpritchard' is the bit in red.

If i delete both of these lines it works, but it saves the entire workbook (800 odd pages) rather than just the selection.

this looks like this:

Sub Macro10()
'
' Macro10 Macro
'

'
    Sheets("Sign off Sheet").Select
    ActiveSheet.ChartObjects("Chart 1").Activate
    Range("A1:F48").Select
    ActiveWorkbook.SaveAs Filename:= _
        "/Users/harrisonpritchard/Desktop/Test_Copy of Cost Calculator_v3.3.pdf", _
        FileFormat:=xlPDF, PublishOption:=xlSelection
    Sheets("Pricing Sheet").Select
End Sub

any ideas how to get this to work?! 

Thanks in advance,

H

----------


## Kevin#

Try this macro - should do what you need. 
There is no requirement to either select the sheet or any charts etc. 

Note a couple of things:
1. The direction of the "slash" is "\" not "/"
(the other one is for web addresses)
2. I have inserted C: at the beginning of your path - check that the path is correct
3. To save as a PDF, Excel exports as a different file format

This should do everything you need
Sub SaveRangeAsPDF()
Sheets("Sign off Sheet").Range("A1:F48").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    "c:\Users\harrisonpritchard\Desktop\Test_Copy of Cost Calculator_v3.3.pdf"
End Sub


```
Please Login or Register  to view this content.
```

----------

