-
Andrew,
To be honest, based on your original question, in my estimation, VBA need not apply here. While I love VBA, there's a few different aspects to maximizing Excel's functionality.
If you had an array of strings in Visual Basic I might say otherwise, but that's a different matter. I would not have posted otherwise. :)
-
The idea is not to *waste* the code.
Nate: could you provide a scenario/sample file where this code might be nice? Something we can add to the kb?
-
Thanks Nate and Dreamboat.
Seeing that non-VBA formulas could count characters in both single cells and multiple cells, I agree that VBA isn't really required, but at the same time I think it's a good reference for people like me to see how it can be done. (I'm still kicking myself to see how easily Jeroen did it with LEN and SUBSTITUTE, plus the case sensitive fix that Cesar added. The SUMPRODUCT formula is really good too)
I think that just familiarizing myelf with the VBA variables etc does a lot of good overall. Gets me thinking how I can use to them to write my own code and get beyond the 'fumbling' stage :)
-
Mine.:p
Just kidding. Andrew has a valid point, we have about 3 different solutions posted on this one topic. They all most likely work(I can only vouch for mine). Who makes the decision on which code gets put into the KB? Andrew was the one looking for the solution, so would not be the one to evaluate it. If he had the skills to do that, he wouldn't have needed us. My suggetion would be a peer review(Vote!!!!)
-
I certainly don't want to step on any toes here, any code that works is good code to me (though I suppose that shorter code has certain advantages)
I'd like nothing more to contribute in any way I can :)
-
Ok. If someone can *name* the 3 solutions, let's do a poll. :)
On a side note...
We don't have to know how to write the code to create a kb entry. We only have to know how to use it. I certainly did not write the ones that are in there under my name. If the person I *stole* the code from is a member, then I put the code in under that person's name (but only admins can do that), so I've really made many more kb entries than it appears.
-
Dreamboat,
My point was not to the fact that he could create the entry or use the code. It was to the fact is he the best person to evaluate the best solution out of the multiple ones presented. Or again, does this even matter, as long as the first solution does the job described?
-
This one's become a moot point, since Nate informs me that there wouldn't ever really be a reason for someone to use code for this purpose, or that it would be very rare for someone to do so.
As for the kb entries...well, there's ALWAYS room for improvement, right?
I figure it this way: If you've got what you believe to be better code than what already exists in the kb, then you let the person who created the article know about it. If they agree, cool. If not, create your own kb entry using (hopefully) the same title, with something a little different at the end that describes the method. While this is NOT a good example literally:
Copy Rows to a New Worksheet - Looping Method
Copy Rows to a New Worksheet - Whatever Method
I don't think we need to be so rigid about our kb entries. While I'd love to enforce good coding standards, we'll never get anything in there at this rate. The other question on autonumbering of Excel files has turned into a circus. I don't blame anyone...we're all trying to do our best. But I don't know that there's a perfect way, and I don't feel we need to provide a perfect way. I think the simpler way is better. We will help no one if we continue to dissect every single piece of code that gets put up there. I also think that few are creating entries for fear someone will question it. I have said before that if I must, I will create all the kb entries myself. I will have this kb if it kills me, and it just might, LOL! Anyway, everyone seems to be making too big of a deal out of this. Without perfect coders, I cannot enforce perfect coding. And perfect coders are too busy to be hanging around here, I think. I hope this is a place for learning. Some of the best coders I know appear to be learning...
-