Save As (2)

Ampleford

Active Member
Joined
Mar 26, 2002
Messages
380
What about Getting a value from the worksheet say "10", then saving the file as "Filename10.xls" I don't know how to get a value from a worksheet (even if it's named) to the VB editor screen for use in there..... Even how to use functions, like random generators in VB

Who can help

Share the Knowledge
This message was edited by Ampleford on 2002-03-28 00:21
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hello! Are you from UK? you know Ampleforth College in York? I wonder if your nick name comes from it
 
Upvote 0
Hi,

All you need to do is split up the path/filename in the save as with & and add in either your variable, or your range.
i.e.

ActiveWorkbook.SaveAs Filename:="C:TESTFilename" & myVariable & ".xls", FileFormat:=xlNormal

ActiveWorkbook.SaveAs Filename:="C:TESTFilename" & Range("A1").value & ".xls", FileFormat:=xlNormal

Oh, and just to add, to get a value from a worksheet into a variable, you'd have something like

Dim myVariable As (whatever it is)

At the top of the macro

Then
myVariable = Range("A1").Value

etc.etc.
This message was edited by AJ on 2002-03-28 04:35
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,453
Members
448,898
Latest member
drewmorgan128

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
Back
Top