+ Reply to Thread
Results 1 to 5 of 5

MS Word - Macro that counts the number of "~" between two specific values

Hybrid View

  1. #1
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,832

    Re: MS Word - Macro that counts the number of "~" between two specific values

    Try:
    Sub Demo()
    Application.ScreenUpdating = False
    With ActiveDocument.Range
      With .Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Text = "ST*SE"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindStop
        .Format = False
        .MatchWildcards = True
        .Execute
      End With
      Do While .Find.Found
        MsgBox Len(.Text) - Len(Replace(.Text, "~", "")) & " tildes found."
        .Collapse wdCollapseEnd
        .Find.Execute
      Loop
    End With
    Application.ScreenUpdating = True
    End Sub
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  2. #2
    Registered User
    Join Date
    11-12-2012
    Location
    San Dieg, CA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: MS Word - Macro that counts the number of "~" between two specific values

    I tweaked this a tiny bit and it works perfectly! Thank you so much for your help.

    LF

+ 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. Macro - Place number & color when find word "inactieve"
    By Jessy142 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-26-2012, 10:54 AM
  2. [SOLVED] How to Count number of "Error" and "OK" after the word "Instrument" found in table row
    By eltonlaw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2012, 06:26 AM
  3. macro required for replaceing specific alphabat with number (like replace "A" with 9)
    By hutton448 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-06-2012, 12:36 PM
  4. [SOLVED] Re: macro for converting number stored as "text" (or preceeded with ') to "number" formatting
    By markx in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-30-2006, 07:14 AM
  5. Replies: 1
    Last Post: 06-23-2006, 10:20 AM

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