Yes, I'm still quite the novice at VBA and such but I'm learning.....albeit, slowly. I'm rebuilding an old inventory sheet for individuals in my company to use to keep their inventories more accurate. It breaks down each user's inventory into alphabetical groups. The whole sheet works as it should now. I'm just trying to tweak it a little to make it better and these tweaks are giving me a headache.
On the INSTRUCTIONS sheet, after they've imported their inventory using the step 1, 2, and 3 buttons, I would like for them to be able to see how many items there are to be counted in each alphabetic grouping before they start that group. I added a button to do that, but I can't get any code to work. I even tried using ChatGPT for an hour or so and it kept failing as well. What seems to be making this so difficult is that there are some Item Descriptions that don't begin with a letter at all. Some begin with a number or special character (almost always an open parenthesis).
If I can ever get some code to work correctly, I would like to do away with the new button that runs that "totaling" macro and integrate the code at the end of the code used when the Step 3 button is clicked.
It's a Monday and I seem to be giving information that isn't pertinent to my problem so here we go:
I need code that will go to the INVENTORY sheet, column D, and count the rows that begin with each number, special character, or letter. Then, report those totals back to the INSTRUCTIONS sheet in cells J24 thru J31 to total those letter groupings shown there. NOTE that the A to B group will also include those items beginning with a number or special character.
The way I've been trying to do this is to report the individual totals to column Z and then use a formula in the appropriate letter grouping to simply sum up the totals. Example: cell J24 is for those items beginning with numbers, spec characters, A, and B. So my formula would simply take what the macro puts in column Z for the total rows beginning with A, B, (, and any number and show that total in J24.
My problem is that I can't get any code I've tried to work and actually total the alphabet groups individually. It either does pretty much nothing or bugs. The code I got from ChatGPT was a new approach I hadn't tried and it errors near the end with an Object variable or With block variable error. That code is below:
I'm open to any approach that will work at this point. If we can use this code, fine. If there's a better way of doing it other than my column Z thought process, I'm good with that too. At this point, I would just like for something that works.
Thank you for your time and any help you can offer!
Bookmarks