Save Excel worksheet as PDF

Akshay_divecha

Board Regular
Joined
Mar 11, 2014
Messages
61
Hi John,

i just changed value in cell I8 to 123-45679-000 and file got saved.

but i would not like to use "-" in my invoice no.

so is it possible that this invoice no with from cell I8 gets copied in cell M1, remove the special characters and then M1 is used for file saving.
 

Some videos you may like

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,272
"/" isn't valid in file names because it separates folder names. This code replaces "/" with "_":
Code:
fname = Replace(Sheets(1).Range("I8"), "/", "_") & " - " & _
            Sheets(1).Range("A11") & " - " & _
            Sheets(1).Range("H11") & ".pdf"
Edit - or if you want every "/" omitted then:

Code:
fname = Replace(Sheets(1).Range("I8"), "/", "") & " - " & _
            Sheets(1).Range("A11") & " - " & _
            Sheets(1).Range("H11") & ".pdf"
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,099,598
Messages
5,469,613
Members
406,661
Latest member
west5405

This Week's Hot Topics

Top