Exporting selected tabs multiple times to different file names

R

Ren

I have a file ("orinignal") that has tabs one, two, three.....

I want to write a macro to export tabs to seperate files and save them
automatically. FIle one would include tab one, two, three. File two would
include tab one, two, four, etc.

I know i can do

Sheets(Array("one", "two", "three")).Select
Sheets(Array("one", "two", "three")).Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\one.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Windows("original.xls").Activate

My question is how do i get back to the original file without hardcoding the
file name like in windows("original.xls").active. Is there a method I can use
to get the file name and save it in a text string and refere it back by using
windows(string).activate .

I am also wondering how i can get a user input text box in excel so I can
ask the user where to save it. I can't remember the method and was probably
searching for the wrong terms in google.

Thanks,

Steven
 
D

Dave Peterson

Dim mySelection as Range
set mySelection = selection
'do your work
application.goto myselection
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top