+ Reply to Thread
Results 1 to 4 of 4

VBA Count Number Of Specific Strings in a Cell

  1. #1
    Forum Contributor
    Join Date
    11-08-2012
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2016
    Posts
    140

    VBA Count Number Of Specific Strings in a Cell

    Hello,
    I am trying to get a VBA script working that will count the number of times a string appears in a cell.
    For the time being I am just working with one cell.
    I can get it working within the worksheet itself with a formula but cannot get it working within a VBA script, it has an issue with the function "SUBSTITUTE", I may be wrong but I'm assuming the function is only a Worksheet function and not a VBA function.
    I have even tried the 'Application.WorksheetFunction' within the VBA script but still nothing. I have looked at several examples off the net and neither state that the word 'SUBSTITUE' needs to be defined.

    I have attached a copy of my test sheet for you to take a look at. The code I am using is;
    Please Login or Register  to view this content.

    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,236

    Re: VBA Count Number Of Specific Strings in a Cell

    Look at Tip #1 here for the syntax needed in VBA to include a regular formula: https://www.excelcampus.com/vba/writ...s-with-macros/
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: VBA Count Number Of Specific Strings in a Cell

    Something like
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    11-08-2012
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2016
    Posts
    140

    Re: VBA Count Number Of Specific Strings in a Cell

    Thank to all, now got it sorted.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 07-02-2018, 12:49 PM
  2. Replies: 5
    Last Post: 02-15-2012, 09:57 AM
  3. [SOLVED] Count number of times a specific number is displayed in a cell ran
    By subs in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  4. Count number of times a specific number is displayed in a cell ran
    By N Harkawat in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 06:05 AM
  5. [SOLVED] Count number of times a specific number is displayed in a cell ran
    By subs in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  6. [SOLVED] Count number of times a specific number is displayed in a cell ran
    By subs in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  7. [SOLVED] Count number of times a specific number is displayed in a cell ran
    By subs in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-27-2005, 01:05 PM

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