macro for save as using concetenation of 2 cells as file nam

cocosoft

New Member
Joined
May 3, 2002
Messages
31
G'day Guys & Gals from Australia.
Can someone help with my subject matter.
I need to be able to run a macro which will join the contents of 2 cells i.e. A1 (Customer Name) & X1 (Quote number)with a hyphen in the middle and use the result for the filename. I would like the macro to autorun when Both cells have been filled.
Any thoughts please.
Cheers Coco
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
This code does not specify a path but simply saves the active workbook as the name you wanted.
<pre>

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Or _
Target.Address = "$X$1" Then
If Len(Range("A1")) <> 0 And _
Len(Range("X1")) <> 0 Then
ActiveWorkbook.SaveAs _
Range("A1") & "-" & _
Range("AX1") & ".xls"
End If
End If
End Sub

</pre>
Tom
 
Upvote 0
Thanks a million Tom., I think that will get me out of trouble. If not I will certainly be able to adapt it.
I am going to post a much curlier problem tomorrow, I hope you get to see it, I'll be interested to see if you have any ideas on my next one.
Thanx again mate -- First time I have ever used a resource like this and you have made my introduction a pleasure.
Cheers Bob Cohen AKA Coco
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,142
Members
448,551
Latest member
Sienna de Souza

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