Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Creating a directory from a date

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



  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Tom is offline
external usenet poster
 
Posts: 1
Default Creating a directory from a date

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

"mark" wrote in message
...
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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Spreadsheet with Date Formula Jschaeffel New Users to Excel 2 February 10th 09 10:45 PM
Creating Directory Structure from Cell Value [email protected] Excel Worksheet Functions 5 December 7th 07 09:33 PM
creating directory for workbook Renee Excel Discussion (Misc queries) 3 August 28th 06 10:00 AM
Creating Links to files in a shared directory grewpp Excel Discussion (Misc queries) 4 February 9th 06 04:22 PM
Creating a Date Selector in Excel VBA? Mark Excel Discussion (Misc queries) 0 November 25th 04 10:59 PM


All times are GMT +1. The time now is 05:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"