+ Reply to Thread
Results 1 to 9 of 9

How to tidy symbols after VBA

  1. #1
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    How to tidy symbols after VBA

    I'm using

    Please Login or Register  to view this content.
    to search for and delete all words composed solely of capital letters.

    It works fine , but does leave behind unwanted apostrophes / question marks / exclamation marks / full stops / Colons and so on.

    For example

    HOW is completely cleared.

    HOW? leaves ?

    HOW! leaves !

    HOW'S leaves 'S

    and so on.

    Can someone advise how to amend my VBA to also remove remaining punctuation and other symbols from the target words?

    Grateful for any advice.


    Last edited by CDandVinyl; 06-13-2020 at 03:27 PM.
    Using Excel , Word and Access 2003 - For the whole of 2024

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to tidy symbols after VBA

    May be...
    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: How to tidy symbols after VBA

    Ok thanks for getting back

    I'm trying

    Please Login or Register  to view this content.
    and getting 'search item not found' messages.

    I'll attach the file I'm practising on. I'm using the same word in the file as in the post above , but the VBA needs to apply of course to any word made up of capital letters.

    Thanks for your help.


    Attached Files Attached Files

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to tidy symbols after VBA

    Oh I had extra [ at the start.

  5. #5
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: How to tidy symbols after VBA

    Ok Thanks. I had another go , this time with

    Please Login or Register  to view this content.
    and still get 'search item not found' messages.

    I tried with the 'match case' and 'use wildcards' switches on and off , but no joy I'm afraid.

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: How to tidy symbols after VBA

    Oh I thought you were using RegEx. That's not the case?

  7. #7
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: How to tidy symbols after VBA

    This is the VBA I'm using presently :

    Please Login or Register  to view this content.

    This leaves the random punctuation marks and so on that I'd like to eradicate.

    I can run search

    Please Login or Register  to view this content.
    with no replace element direct from the search and replace interface. Maybe I'm overlooking something. Grateful for your advice.



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

    Re: How to tidy symbols after VBA

    Try:
    .Text = "<[A-Z]{2}[! ^13]@([ ^s^13])"
    .Replacement.Text = \1

    The above ensures any word starting with at least two capitals and all subsequent characters up to the next following space or paragraph break (whichever comes first) are deleted. This will capture any apostrophes & punctuation.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  9. #9
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: How to tidy symbols after VBA

    Excellent - thanks. It works fine.

    Grateful for your time and expertise.

    Last edited by CDandVinyl; 06-17-2020 at 06:59 PM.

+ 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: 7
    Last Post: 05-10-2018, 04:43 PM
  2. Nedd some help to tidy up this
    By miguelcubeles in forum Excel General
    Replies: 2
    Last Post: 11-12-2014, 08:41 PM
  3. Too Many Arguments? Can someone tidy up?
    By nobodyukno in forum Excel General
    Replies: 8
    Last Post: 01-18-2013, 12:15 PM
  4. Want to tidy up my workbook...
    By AlbertKJ in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 01-05-2012, 09:04 PM
  5. Macro Tidy
    By Martin Jol in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-08-2007, 10:53 AM
  6. Can anyone help me tidy up?
    By drucey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-05-2006, 03:10 PM
  7. [SOLVED] Tidy Up
    By Pete in forum Excel General
    Replies: 4
    Last Post: 05-09-2005, 01:06 PM

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