Text from a cell to a macro

Keith.Jackson

Board Regular
Joined
Mar 31, 2005
Messages
115
How can I pull text from a cell in a worksheet and use that text to name a file in a sub routine? For example , the name Bill Smith is in a cell in a worksheet but sometimes that cell is another name. I want to set up a macro to e mail a file to someone with the name in that cell as the file being e mailed.

Thanks
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
You will have some syntax that says "Sendto" or similar, like this:

.sendto "Bill Smith"

replace "Bill Smith" with [a1].text, where [a1] contains the name

eg

.sendto [a1].text
 
Upvote 0
Record a macro to "save as" a name:

The look at the macro and replace the name in quotes with:
sheets("Sheet1").range("a1").text
Leave the ".xls" in brackets and use ampersands

You'll end up with seomething like this:

ActiveWorkbook.SaveAs "c:\" & .sheets("Sheet1").range("a1").text & ".xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False

Hope that helps
 
Upvote 0

Forum statistics

Threads
1,211,802
Messages
6,104,064
Members
447,892
Latest member
madara uchiha

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