dynamic filenames

kemperohlmeyer

Board Regular
Joined
Oct 4, 2006
Messages
73
I am writing a macro that saves multiple sheets after each one is calculated from a list.

ie, the sheet calculates, is exported as a webpage, new data pulled, calculated, exported etc.

How do i make the filename it is exported as reflect the data pulled in. For example if the data is from a company called KO the file should be named KO.

Thoughts?

Kemper
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

lozzablake

Well-known Member
Joined
Dec 15, 2005
Messages
818
you define a variable as a string. You assign the company name to the string (plus any other test you want) and then save the file using the variable as the filename eg:

Dim strFileName as String

strFileName=Range("a1")

thisworkbook.saveas filename:=strFileName

etc
 

Forum statistics

Threads
1,141,681
Messages
5,707,792
Members
421,527
Latest member
Tamiwsw

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