ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Saveas VBA question (https://www.excelbanter.com/excel-discussion-misc-queries/232563-saveas-vba-question.html)

Lost

Saveas VBA question
 
OK this code saves the file as the date which is entered into cell B2. Then
places the file in a folder that matches the months number (January = 1,
Febuary = 2,.... December = 12). The folders have to be named with numbers
tho for this to work. How could I tweak this to match January 1 2009 to the
folder named January?

Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyPath As String
If Target.Address(False, False) = "B2" Then
MyPath = "F:\RS_MS Training\RS Stuffing\3rd Stuff\Penless\TQC\Filled out
Monthly TQC\" & Month(Target.Value) & "\"
ThisWorkbook.SaveAs Filename:=MyPath & Format(Target.Value,
"mmmm-dd-yy") & ".xls"
End If
End Sub


Jarek Kujawa[_2_]

Saveas VBA question
 
instead of

Month(Target.Value)

try

MonthName(Month(Target.Value))

pls click YES if it helped


On 2 Cze, 08:36, Lost wrote:
OK this code saves the file as the date which is entered into cell B2. *Then
places the file in a folder that matches the months number (January = 1,
Febuary = 2,.... December = 12). *The folders have to be named with numbers
tho for this to work. *How could I tweak this to match January 1 2009 to the
folder named January?

Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyPath As String
If Target.Address(False, False) = "B2" Then
* * MyPath = "F:\RS_MS Training\RS Stuffing\3rd Stuff\Penless\TQC\Filled out
Monthly TQC\" & Month(Target.Value) & "\"
* * ThisWorkbook.SaveAs Filename:=MyPath & Format(Target.Value,
"mmmm-dd-yy") & ".xls"
End If
End Sub




All times are GMT +1. The time now is 08:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com