|
-
May 20th, 2013, 10:23 PM
#1
Thread Starter
Member
[RESOLVED] Grrr... Saving Excel File As Cell Value
Hey Guys,
I currently creating a pay period spreadsheet through excel with a calendar that pops up after clicking the pay period cell to show the pay period which you select. example: Click May 1st 2013 on the calendar and cell R2 displays date 5/1/13. I then tried creating a button to save the excel file as the date specified in cell R2 but no luck it wouldn't work. So I finally thought that maybe its because you cant save "/" as your file so on Sheet 2 I created a cell that would display Sheet1's R2 cell as May 1st, 2013. Tried saving again and it wouldn't save. Another error appeared. Am I doing something wrong or is it just not possible to do this action? Please help me, been puzzling me for over a week.
Code:
Sub SaveMe()
Dim strName As String
strName = Sheet2.Range("F1").Value
ActiveWorkbook.SaveAs strName
Exit Sub
End Sub
Office Version: 2007
-
May 21st, 2013, 05:48 AM
#2
Re: Grrr... Saving Excel File As Cell Value
Sheet1's R2 cell as May 1st, 2013
probably the comma, best to format the date as you go, like
Code:
strName = format(Sheet2.Range("F1").Value, "yyyymmdd")
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
May 21st, 2013, 10:59 PM
#3
Thread Starter
Member
Re: Grrr... Saving Excel File As Cell Value
You sir are a genious haha such a simple fix, I've tried the formatting thing also just set it up wrong apparently. You rock THANKS!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|