HI I solved this earlier today but had a extra question.
I got this code from PCI earlier and it solved my problem. But i would like to have the code moderated so it can also change below if i insert new files. So what ever the input is it have to insert the number.
The input could look like this
C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ 0001 - Georgia Satellites - Keep Your Hands To Yourself.zip
C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ tmsjek - Ig Joe Turner - Shake Rattle & Roll.zip
C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ 0003 - Jerry Lee Lewis - Great Balls Of Fire.zip
C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ 0004 - Jimmy Buffett - Margaritaville.zip
C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ nenm5 - Otis Day & The Knights - Shout.zip
C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ 0006 - Ray Charles - Hit The Road Jack.zip
C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ 0007 - Sly & The Family Stone - Dance To The Music.zip
C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ 0008 - Stray Cats - Rock This Town.zip
So what ever i do it will make the order with 4 digits in upper example it will replace tmsjek with 0002
and replace nenm5 with 0005. In this way i can always insert new files and make them in order.
This is the code working but it will now delete the old. if i run it now it will keep the 0006 and add one more.
Please have a look thanks
Sincerely
Abjac
Sub Treat()
Sheets(1).Activate
Dim WkRg As Range
Dim F As Range
Dim I As Long, IStg As String
Dim LStg As String, RStg As String
Application.ScreenUpdating = False
Set WkRg = Range(Cells(2, "B"), Cells(Rows.Count, "B").End(xlUp))
For Each F In WkRg
I = I + 1
IStg = Format(I, " 0000 ")
LStg = Left(F, InStrRev(F, "\"))
RStg = Right(F, Len(F) - InStrRev(F, "\"))
F.Value = LStg & IStg & RStg
Next F
Application.ScreenUpdating = True
End Sub
Bookmarks