Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 275
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 275
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 275
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save Excel Worksheet As CSV - No Save As Dialog SQLServant Excel Programming 1 September 29th 06 12:36 PM
Problem: vba code for creating a button to save worksheet as Cell caldog Excel Programming 7 September 26th 06 10:04 PM
Totally Disabling (^ save ) (Save as) and Save Icon – Which code do I use: harpscardiff[_10_] Excel Programming 8 November 10th 05 12:24 PM
Placing a code before Save & Save As Alex Martinez Excel Programming 1 September 27th 05 06:35 AM
Worksheet Buttons (Save, Save As, Cut, Paste, etc.) Not Working SuzieQ12345 Excel Worksheet Functions 5 January 21st 05 02:57 PM


All times are GMT +1. The time now is 04:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"