if you are using xls file you have to change this line
toCode:strExt = ".xlsm" 'Change to suit
Code:strExt = ".xls" 'Change to suit
if you are using xls file you have to change this line
toCode:strExt = ".xlsm" 'Change to suit
Code:strExt = ".xls" 'Change to suit
Okay, I guess it must be done to change the formats. - This is great.
What do you say about the other problem - shown in the picture?
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
https://eileenslounge.com/viewtopic.php?p=244184#p244184
https://eileenslounge.com/viewtopic.php?p=246586#p246586
https://eileenslounge.com/viewtopic.php?p=246112#p246112
https://eileenslounge.com/viewtopic.php?p=246112#p246112
https://eileenslounge.com/viewtopic.php?p=245761#p245761
https://eileenslounge.com/viewtopic.php?p=245722#p245722
https://eileenslounge.com/viewtopic.php?p=245616#p245616
https://eileenslounge.com/viewtopic.php?p=247043#p247043
https://www.excelfox.com/forum/showthread.php/2307-VBA-Range-Sort-with-arrays-Alternative-for-simple-use
https://eileenslounge.com/viewtopic.php?p=245238#p245238
https://eileenslounge.com/viewtopic.php?p=245131#p245131
https://eileenslounge.com/viewtopic.php?f=18&t=31638
https://eileenslounge.com/viewtopic.php?p=244579#p244579
https://eileenslounge.com/viewtopic.php?p=244648#p244648
https://eileenslounge.com/viewtopic.php?p=244647#p244647
https://eileenslounge.com/viewtopic.php?p=244577#p244577
https://eileenslounge.com/viewtopic.php?p=245201#p245201
https://eileenslounge.com/viewtopic.php?p=243975#p243975
https://eileenslounge.com/viewtopic.php?p=243884#p243884
https://eileenslounge.com/viewtopic.php?p=242439#p242439
https://eileenslounge.com/viewtopic.php?p=243595#p243595
https://eileenslounge.com/viewtopic.php?p=243589#p243589
https://eileenslounge.com/viewtopic.php?p=243589#p243589
https://eileenslounge.com/viewtopic.php?p=243002#p243002
https://www.eileenslounge.com/viewtopic.php?p=242761#p242761
https://eileenslounge.com/viewtopic.php?p=242459#p242459
https://eileenslounge.com/viewtopic.php?p=242054#p242054
https://eileenslounge.com/viewtopic.php?p=241404#p241404
https://eileenslounge.com/viewtopic.php?p=229145#p229145
https://eileenslounge.com/viewtopic.php?p=228710#p228710
https://eileenslounge.com/viewtopic.php?p=226938#p226938
https://eileenslounge.com/viewtopic.php?f=18&t=28885
https://eileenslounge.com/viewtopic.php?p=222689#p222689
https://eileenslounge.com/viewtopic.php?p=221622#p221622
https://eileenslounge.com/viewtopic.php?f=27&t=22512
https://eileenslounge.com/viewtopic.php?f=26&t=26183
https://eileenslounge.com/viewtopic.php?f=26&t=26030
https://eileenslounge.com/viewtopic.php?p=202322#p202322
https://www.excelforum.com/word-formatting-and-general/1174522-finding-a-particular-word-phrase-in-word.html#post4604396
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
Last edited by DocAElstein; 04-16-2024 at 06:36 PM.
are you working with last version ? I don't think
Hi, Pleace see post №10. There are the problem in the picture.
I use excel 2003 and excel 2007.
Thank you.
For last version I mean the last code I pasted
Hi, I'm totally confused.
What you can not understand me and what is the last of what you write.
Penultimate and last macro work, but if once has stored in a new file in our example Ivan Ivanov 0001 or Ivan Ivanov-1 or Ivan Ivanov 1 - it does not matter, then stored on it my friend, and I want to create a new file with a serial number, and I can not do anything, if you attach an excel file?
Maybe when you run things (code), but to me it does not. I'll try again to explain:
1 Open the "Ivan Ivanov" - write something.
2 Press the "save" I mean macro
3 in my folder already have a new file - "Ivan Ivanov-0001" or "Ivan Ivanov-1" or whatever
4 re-open the "Ivan Ivanov" - write something
5 Press "save" I mean macro
6 in my folder should have a new file, but number 2 - "Ivan Ivanov-0002" or "Ivan Ivanov-2" or whatever it is there
And in my case I hit the macro (button), he replaced it on the old "Ivan Ivanov-0001" or "Ivan Ivanov-1" or whatever it is there
Am I wrong somewhere or code not working?
Thanks in advance
with this code
if you run macro you can save with progressive number, if you want save the original file with original name you have to save it normally.Code:Sub saveProgressiveNumber1() Dim newFileName As String, strPath As String Dim strFileName As String, strExt As String strPath = "C:\Users\ivan\Desktop\" 'Change to suit strFileName = "Ivan Ivanov" 'Change to suit strExt = ".xlsm" 'Change to suit newFileName = strFileName & "-" & GetNewSuffix(strPath, strFileName, strExt) & strExt ActiveWorkbook.SaveCopyAs strPath & newFileName End Sub Function GetNewSuffix(ByVal strPath As String, ByVal strName As String, ByVal strExt As String) As Integer Dim strFile As String, strSuffix As String, intMax As Integer strFile = Dir(strPath & "\" & strName & "*") Do While strFile <> "" strSuffix = Mid(strFile, Len(strName) + 2, Len(strFile) - Len(strName) - Len(strExt) - 1) If Mid(strFile, Len(strName) + 1, 1) = "-" And CSng(strSuffix) >= 0 And _ InStr(1, strSuffix, ",") = 0 And InStr(1, strSuffix, ".") = 0 Then If CInt(strSuffix) >= intMax Then intMax = CInt(strSuffix) End If strFile = Dir Loop GetNewSuffix = intMax + 1 End Function
Hello, apparently the problem is with me, so I ask you to look at video file that show what's where and how to set my folder after number 1, number 2 is missing.
Last edited by k0st4din; 07-16-2013 at 10:54 PM. Reason: Remove video
Don't change anything in Function GetNewSuffix, you can change the path only in the sub
Okay, but if i do not change out my error immediately.
See photo:
Screen_02 Jul. 16 17.00.jpg
Screen_01 Jul. 16 17.00.jpg
Last edited by k0st4din; 07-16-2013 at 07:11 PM.
Bookmarks