Save workbook based on cell value in different sheet

marcus314

New Member
Joined
Jun 4, 2014
Messages
15
Hello,

I'm wishing to save a new workbook based on a cell value in a different sheet. I was able to get this to work based on the cell value of the active sheet, but when I try to reference a different sheet, I get an error. Considering I'm still new to learning VBA syntax, this isn't surprising!

The key excerpt of the code is below:

Code:
.SaveAs ThisWorkbook.Path & Application.PathSeparator & "R-" & Worksheets("File Namer").Range("D1").Value

Any ideas?

Thanks!
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,389
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
What error do you get? Is it on the line you posted? What's in cell D1 of the sheet File Namer? Is that line part of a With-End With construct? If yes, can you post the entire construct?
 

Watch MrExcel Video

Forum statistics

Threads
1,123,057
Messages
5,599,550
Members
414,316
Latest member
ExcelLee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top