Inserting VBA code with Excel

  • Thread starter Thread starter sowetoddid
  • Start date Start date
S

sowetoddid

This is the what I want to happen...

ActiveWorkbook.SaveAs Filename:=Range("B1").Value


The code will read the value in B1 and make that the saveas file name.



How do I do this??


Thank you
 
That code does do it. If you put it in a macro and assign that macro to a
toolbar button, you will have an 'on-demand' facility.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
sowetoddid,

Exactly the way that you wrote it, just wrap it in a subroutine:

Sub sowetoddidSave()
ActiveWorkbook.SaveAs Filename:=Range("B1").Value
End Sub

Run the macro manually, call it from a button, or call it from an
event. Lots of choices, but you need to say which....

HTH,
Bernie
MS Excel MVP
 
Sorry to seem ignorant, but how do I make that a macro withou
physically recording it
 
OK!!! Great! That worked. Now, how do I choose where it will be save
at on my computer??

Can it be saved some where besides "My Documents"?? That is where i
automatically goes.


Thank you, Thank you
 
sowetoddid,

Sub sowetoddidSave()
ActiveWorkbook.SaveAs Filename:="C:\Your desired Folder path name\" &
Range("B1").Value
End Sub
 
You have the code from Bernie to save to a drive and folder.

Note of caution here: I highly recommend you DO NOT save directly to your "a"
drive, which I assume is a floppy drive.

File corruption is quite commonplace when doing this.

Floppies and other removable media are for transporting and/or for backups of
copied files.

Save to and Open from your Hard Drive.

Gord Dibben Excel MVP
 
Back
Top