+ Reply to Thread
Results 1 to 1 of 1

Double Quotes & Variables

  1. #1
    Registered User
    Join Date
    08-30-2012
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    83

    Double Quotes & Variables

    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 -

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    all cells containing "PDF" would be counted.


    Now if I want to generate this formula using VBA, I can do this -

    Please Login or Register  to view this content.
    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!

    Please Login or Register  to view this content.

    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
    Last edited by zbor; 09-28-2012 at 04:34 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1