PC Review


Reply
Thread Tools Rate Thread

Automaic Folder Numbering

 
 
David Shoemaker
Guest
Posts: n/a
 
      7th Jan 2010
This is a line of code that i use to create folders on my computer with what
ever value B3 is, now what i would like to do is by clicking a button have it
look under a certain folder and audomaticlly enter the next 5 digit number
and create a folder with that number and put it into a cell in my worksheet
like this - 10001, 10002, 10003, etc......

MkDir "C:\\Globe Photo Engraving\Jobs\" & Range("B3").Value
 
Reply With Quote
 
 
 
 
Bernie Deitrick
Guest
Posts: n/a
 
      7th Jan 2010
David,

I have assumed the sheet name is Sheet1 - enter the starting number in cell B3 there, and run this
macro:

Sub CreateFolder()
Dim MyFilePath As String
Dim FolderC As Integer

MyFilePath = "C:\Globe Photo Engraving\Jobs\"
FolderC = Worksheets("Sheet1").Range("B3").Value
On Error GoTo FolderExists '<< in case folder exists
TryAgain:
MkDir MyFilePath & FolderC '<< create folder
Worksheets("Sheet1").Range("B3").Value = FolderC + 1
Msgbox "I just created the folder " & MyFilePath & FolderC
Exit Sub
FolderExists:
FolderC = FolderC + 1
Resume TryAgain
End Sub


--
HTH,
Bernie
MS Excel MVP


"David Shoemaker" <(E-Mail Removed)> wrote in message
news:389F4F7E-F231-4879-8781-(E-Mail Removed)...
> This is a line of code that i use to create folders on my computer with what
> ever value B3 is, now what i would like to do is by clicking a button have it
> look under a certain folder and audomaticlly enter the next 5 digit number
> and create a folder with that number and put it into a cell in my worksheet
> like this - 10001, 10002, 10003, etc......
>
> MkDir "C:\\Globe Photo Engraving\Jobs\" & Range("B3").Value



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to disable automaic function hui Microsoft Excel Discussion 1 11th Dec 2005 02:16 AM
automaic email =?Utf-8?B?YmliZWs=?= Microsoft Outlook Contacts 0 14th Aug 2005 12:27 PM
Automaic redirect hyperlink Kris Kringle Lick A Pringle Microsoft Frontpage 7 4th Jan 2005 09:23 PM
How do I enable an automaic away message in Outlook for incoming . =?Utf-8?B?RHJhd1BsYW5zNHU=?= Microsoft Access 2 30th Dec 2004 11:41 PM
Problem wit automaic updates Karel Hoogenraad Windows XP General 1 26th Sep 2003 09:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:54 AM.