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
 

Some videos you may like

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

tactps

Well-known Member
Joined
Jan 20, 2004
Messages
3,459
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
 

Keith.Jackson

Board Regular
Joined
Mar 31, 2005
Messages
115
How can I rename a file created in a macro based on a name in text in a cell on a worksheet?
 

tactps

Well-known Member
Joined
Jan 20, 2004
Messages
3,459
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,316
Messages
5,595,448
Members
413,993
Latest member
CSEGUIN1973

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