melodramatic
Board Regular
- Joined
- Apr 28, 2003
- Messages
- 187
- Office Version
- 365
- Platform
- Windows
I am trying to run a macro that will go thru all of my project folders, renaming a specific sub-folder.
My loop so far works great! That is, if you don't mind doing anything more than changing out the count of the loop. What I need is the actual language that will run the folder rename for me.
Here's what I have:
Sub FinalDisposition()
'This routing will loop thru all the numbered project folders, changing the "5_Shipping" folder to "5_Final_Disposition"
'Cell A1 - how many times to run loop
'Cell A2 - how many times loop has already run
'Cell A3 - which loop is being run now (calculation is A2+1)
'Cell A4 - PN (figured by a calculated based on Cell A3)
'Cell A5 - root folder for PN (figured by a calculation based on Cell A4)
Dim FinalDisp As Long
For FinalDisp = 1 To Range("A1")
Dim LastRun As Long
Dim RunNow As Long
Dim RootFolder As String
Dim OldFolder As String
Dim NewFolder As String
LastRun = Range("A2")
RunNow = Range("A3")
RootFolder = Range("A5")
OldFolder = "5_Shipping"
NewFolder = "5_Final_Disposition"
' Name RootFolder & OldFolder As RootFolder & NewFolder
Range("A2").Select
ActiveCell.FormulaR1C1 = RunNow
Next FinalDisp
End Sub
Any help you could give me would be great!
My loop so far works great! That is, if you don't mind doing anything more than changing out the count of the loop. What I need is the actual language that will run the folder rename for me.
Here's what I have:
Sub FinalDisposition()
'This routing will loop thru all the numbered project folders, changing the "5_Shipping" folder to "5_Final_Disposition"
'Cell A1 - how many times to run loop
'Cell A2 - how many times loop has already run
'Cell A3 - which loop is being run now (calculation is A2+1)
'Cell A4 - PN (figured by a calculated based on Cell A3)
'Cell A5 - root folder for PN (figured by a calculation based on Cell A4)
Dim FinalDisp As Long
For FinalDisp = 1 To Range("A1")
Dim LastRun As Long
Dim RunNow As Long
Dim RootFolder As String
Dim OldFolder As String
Dim NewFolder As String
LastRun = Range("A2")
RunNow = Range("A3")
RootFolder = Range("A5")
OldFolder = "5_Shipping"
NewFolder = "5_Final_Disposition"
' Name RootFolder & OldFolder As RootFolder & NewFolder
Range("A2").Select
ActiveCell.FormulaR1C1 = RunNow
Next FinalDisp
End Sub
Any help you could give me would be great!