Creating a directory from a 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
 
T

Tom

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 :).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top