![]() |
VB code to save worksheet as...
Hi,
At the end of my vb code I would like the worksheet to be saved giving it the name of 2 cell refs 1st cell ref J3 which holds a date ie 15 March 2007 2nd cell ref U3 which holds a game number so example J3 = 15 MARCH 2007 , U3 = GAME 4 save worksheet name as 15MARCH2007GAME4 any ideas ? thanks |
VB code to save worksheet as...
Hi
you could try adding the cells refs to a string then use that as your saveas name. Option Explicit Dim fName As String Private Sub CommandButton1_Click() fName = [j3] & [u3] ActiveWorkbook.SaveAs Filename:=fName End Sub hope this is of some help S |
VB code to save worksheet as...
Sorry i just read your message again and think you were wanting to
rename the sheet which in that case you could use Option Explicit Dim fName As String Private Sub CommandButton1_Click() fName = [j3] & [u3] ActiveSheet.Name = fName ActiveWorkbook.Save End Sub S |
VB code to save worksheet as...
Dim s as String
s = Replace(range("J3").Text," ","") s = s & Range("U3").Text Activesheet.Parent.SaveAs "C:\MyFolder\" & s & ".xls" -- Regards, Tom Ogilvy "Anthony" wrote: Hi, At the end of my vb code I would like the worksheet to be saved giving it the name of 2 cell refs 1st cell ref J3 which holds a date ie 15 March 2007 2nd cell ref U3 which holds a game number so example J3 = 15 MARCH 2007 , U3 = GAME 4 save worksheet name as 15MARCH2007GAME4 any ideas ? thanks |
VB code to save worksheet as...
Thanks Tom, I'll give that a go later this evening at home
"Tom Ogilvy" wrote: Dim s as String s = Replace(range("J3").Text," ","") s = s & Range("U3").Text Activesheet.Parent.SaveAs "C:\MyFolder\" & s & ".xls" -- Regards, Tom Ogilvy "Anthony" wrote: Hi, At the end of my vb code I would like the worksheet to be saved giving it the name of 2 cell refs 1st cell ref J3 which holds a date ie 15 March 2007 2nd cell ref U3 which holds a game number so example J3 = 15 MARCH 2007 , U3 = GAME 4 save worksheet name as 15MARCH2007GAME4 any ideas ? thanks |
VB code to save worksheet as...
Thanks 'Incidental' I will try that later
"Incidental" wrote: Sorry i just read your message again and think you were wanting to rename the sheet which in that case you could use Option Explicit Dim fName As String Private Sub CommandButton1_Click() fName = [j3] & [u3] ActiveSheet.Name = fName ActiveWorkbook.Save End Sub S |
All times are GMT +1. The time now is 10:07 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com