Hi There, first time poster, slightly longer time user!
I have a column with has file extensions in it e.g. the cell values in the column are either "jpg", "pdf", "bmp", "vsd", "gif" etc.
Originally, I only wanted the ability to count how many jpg files there were, but now I want the ability to choose which filetype to search for using a variable to define the prefixes above.
If I were just to input the formula straight into an excel cell, it would be nice & easy -
all cells containing "PDF" would be counted.
Now if I want to generate this formula using VBA, I can do this -
Same result - great.
Now onto what I want to do! As stated, I want the flexibility to enter the file extension as a variable, so it is easy to change for different file types. I don't want to have to replicate the line above with a bunch of cases or if statements, so I simply(!) want to replace "PDF" with "FileType$" (or any name you care to give it) and then define the variable at an earlier stage.
The problem comes because I don't really know how to put a single quote inside quotes (if that makes sense?!). I understand that, as "FileType$" is a variable, it is concatenated with "&". It must however also be encased in Quotes when in the cell formula, and I don't know how to implement this!
Right, in the process of writing the question, I have eventually bungled my way to the correct number of quotes! Below is the line I was attempting to get!
Hope this helps someone avoid the hour or two I spent strangling my computer! So it appears that 2 double quotes represents a single quote. If someone would like to explain this for me, it might allow me not to scream the next time I forget!
J
Bookmarks