View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Lost Lost is offline
external usenet poster
 
Posts: 55
Default 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