Creating a directory from a date

  • Thread starter Thread starter mark
  • Start date Start date
M

mark

Here's one way:

Sub test()

Dim stYear As String
Dim stExists As String


stYear = Year(Range("b10").Value)
stExists = Dir("f:\" & stYear, vbDirectory)

If stExists = "" Then

MkDir "f:\" & stYear

End If

End Sub
 
Thank you. This worked like a charm. I didn't know about the Year, (and I'm
assuming Day, and Month) functions. I really need to broaden my VBA
vocabulary :).
 
Back
Top