last day (15 days later) » 

6:26 PM
1
A: Count number of unique values containing text

lturner Firstly, you must enable 'Microsoft Scripting Runtime' from within Tools --> References within the Visual Basic Editor. You assign the data from the worksheet into an array; then import everything which fits the string criteria, and isn't a duplicate, into a dictionary. You can check for dup...

 
Please correct me if my understanding is wrong, so basically what I need to do is put the range of cells where the data is and from the dictionary I can check if there are duplicates and exclude them from the .Count? Apologies for my confusions i'm fairly new with VBA and im just starting to work on my first full on project with it. I definitely need to check up on the Dictionary Object for VBA.
 
Yeah, basically: range into Array, then items from the array where a) it matches the pattern "ABC-QR" and b) the full string has not already been added into the dictionary, will then be added to the dictionary. So you're not excluding anything from the count, but rather excluding them from being added to the dictionary in the first instance. Yeah it's worth reading up on dictionaries and arrays; they're extremely powerful :)
 
I understand. And yes, I will definitely read up on dictionaries and arrays :) But, the thing is, "ABC-QR" is not the whole value of the cell, it differs everytime, there might just be duplicates like two "ABC-QR0123456" but it can also have the value of "ABC-QR567890". Is this unclear in some ways? I feel like I'm not explaining it good enough. lol. sorry.
 
So if there's two "ABC-QR0123456" and one "ABC-WR567890" in the range, then using the .Count property would return 2. It counts all values containing "ABC-QR" but effectively removes duplicates. Give it a test and you will see. Let me know if you have any other questions :).
 
Alright :) Gimme a couple of minutes I'll give it a try
Wow this works beautifully! :D Thanks mate! Btw, can I ask you a couple of more questions via private message?
 
6:26 PM
Glad to help! Sure, go for it.
 
Is there a way I can reach you in private @lturner?
 
I started a discussion
 
Thanks
Anyway, this is connected to the same project I'm working right now, it invloves a message box
 
Okay
 
Basically, what I wanna do is pop up a message box if a set of cells are empty
Hold on, I think I know how to do this
Lol. -_-
The idea just came to me
I tried doing it a couple of weeks ago but i failed miserably lol, but I think it'll work this time.
 
6:32 PM
Haha, okay cool. Good luck. Let me know if you do need any help.
 
6:49 PM
Alright will do!
 

last day (15 days later) »