Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Automaic Folder Numbering

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Automaic Folder Numbering

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" wrote in message
...
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
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
Please help. Remove dups automaic of same name,price,month. CYNTHIA Excel Discussion (Misc queries) 6 August 29th 07 10:24 PM
how can i change my default working folder to a networked folder? wizard1154 Excel Discussion (Misc queries) 4 April 18th 07 07:29 PM
How to decide folder-depth or How to select more folders/subfolders (folder-tree) ? Subteam Excel Discussion (Misc queries) 2 May 7th 06 08:14 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 04:28 PM
automaic "nice" display of the labels in a pie chart Pierre Charts and Charting in Excel 1 October 1st 05 02:50 PM


All times are GMT +1. The time now is 04:56 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"