-
Vba Auto Increment File Name Convention카테고리 없음 2020. 2. 11. 03:38
I've looked everywhere for something like that, and I found a few that are close, but nothing that I can work with.EDITED = 4:35pm ESTBasically I want to be able to type those characters in a box, and have the macro automatically select all rows containing those first characters in A:ATo explain in detail, this is part of a larger project in which I have to properly tag and rename 23K karaoke mp3+g files. Ordinary music tagging programs don't work with karaoke files. On top of that there is a corresponding.cdg file that must share the exact same name as it's respective.mp3 file.The issue with the files right now is that they are an absolute mess. They lack naming convention in every possible screwed up way you can imagine. The only silver lining I see is that the vast majority of them contain the manufacturer (MFR) ID# which relates to the data in A:A.I have a huge (47,000 row) spreadsheet that contains the MFR IDs and the respective artist and title of nearly every karaoke song into existence.
I have a working vb script that will properly rename files based on this data. That in of itself was a massive headache because the MFG IDs could be anywhere within the filename. Obviously going through 23,000 files referencing a 47,000 spreadsheet is putting excel vb through it's paces.
In otherwords it crashes.Splitting this spreadsheet up by manufacturer, and the files respectively allows me to reduce the code needed to make this work and less information to reference when renaming the files. This works through the tests that I've run it through which has lead me to this sub-project. For what it's worth, I'm not going to say that code couldn't be improved, but I'm kind of amazed that I got it running as I'm a bit rusty on vba these days.I hope this helps everyone understand my predicament.
I apologize for the confusions.Everyone's help is greatly appreciated. Thank you all so much!Now I need to lay down for a bit, because i have a headache. I don't know exactly. I exported the values in that column and removed everything after the first 3 digits and got 484. It should be noted that there is two manufacturers (column A) that use 2 digit prefixes, so that number is probably around 400 or so. In any case, it is probably better that I separate the spreadsheets manually.I should also clarify that each manufacturer uses probably 10 or different prefixes on average. So ACD, ACK, ACT, could be from the same manufacturer.
Vba Auto Increment File Name Convention Center
So even though I may have 400 or so different prefixes. I'll end up with about 30 or so different spreadsheet once they are sorted by the manufacturer which is the end goal.I'm going to edit the original post accordingly. Yeah I thought about that, I'm in the process of making a that spreadsheet right now. Once this is finished I can hopefully create a reference table with it so that I can add a column corresponding to the manufacturer, and then create the separate spreadsheets based on that. The main reason this needs to be done is that I have some scripts that will be running on those spreadsheets and the code is too complicated and the spreadsheet is too large causing excel to crash. Sorting them by manufacturer means less code, smaller spreadsheets and hopefully no crashes.
Usually, but the script that I'll be running after this is going to be used to tag and rename files in a directory which happen to be karaoke files. The issue here is that I need to fix 23,000 or so filenames that are an absolute and total mess devoid any sort of naming convention. Most filenames however contain the manufacturer ID# (A:A), and the 47,000 row excel file that I'm working with now contains all of the manufacturer codes. So with 'a little work' on this spreadsheet, I can use the manufacturer codes to properly name and tag the files.Ordinary mp3 auto-tagging programs don't work on karaoke files, and there is a.cdg file that needs to share the exact same file name as it's respective mp3 file. The disc id within the file name could be anywhere within the filename (as I said there is no standard naming convention). The relative handful files that do not contain a disc id will be identified and based on the closest match to title and artist within the filename.Having the files, and spreadsheets sorted by manufacturer allows me to trim some code out, and perform this job incrementally. I did a test run already, and the code does work.Granted, not saying that it couldn't be improved.
But this has been an absolute nightmare for me and the fact that it runs at all is good enough right now. I seriously don't wanna ever have to do this again. Right now, this will give you an input box and will return a MsgBox for every cell that matches the string you entered into the InputBox.If you give me more clear direction, I can help you do things with the cell that is returned. Individually highlighting each row that contains the string is kind of a pain.
If you're looking to just move the values around and delete rows, that's far easier to do.The code is also pretty fast, I tested doing the For Each Cell loop and transfering the matched cell value to column G with 40,000 rows of data and it did it in about 5 seconds. Sub RedditLastRow = Sheets('sheet1').Range('A' & Rows.Count).End(xlUp).RowPrefix = InputBox('Enter the Prefix')'Search every Cell to see if it contains the String entered in the InputBoxFor Each Cell In Sheets('Sheet1').Range('A1:A' & LastRow)'If you find a MatchIf InStr(1, Cell, Prefix) 0 ThenMsgBox CellEnd IfNextEnd Sub. Will the data always be sorted so that prefixes with the same name are next to one another in Column A?
Vba Increment Variable By 1
I know this is slightly off the main question, but I think it answers the fuller question.If you have a letter in A1, and you wish it to be stepped by a number in B1, the following formula combo will achieve it from single letters to ZZ. =IF(LEN(A1)1,IF((CODE(RIGHT(A1,1))+$B$1)CODE('Z'),CHAR(CODE(LEFT(A1,1))+1)&CHAR(CODE(RIGHT(A1,1))-21),LEFT(A1,1)&CHAR(CODE(RIGHT(A1,1))+$B$1)),IF((CODE(A1)+$B$1)CODE('Z'),'A'&CHAR(CODE(A1)-21),CHAR(CODE(A1)+$B$1)))Copy it down the column and the results are there. Change the B5 number and the results change.