+ Reply to Thread
Results 1 to 3 of 3

Macro to strip text from cell.

Hybrid View

  1. #1
    Registered User
    Join Date
    09-24-2014
    Location
    FL, USA
    MS-Off Ver
    Office 2010
    Posts
    18

    Macro to strip text from cell.

    I am working on a sub procedure that will basically loop through a column of data of variable length, strip out the text from those cells, and place the remaining numbers/characters into a new column. I have everything worked out except I can't get a good code for stripping out the text and spaces and leave just the numbers and characters. An example value would be "100-150/300 some kind of text" where I want to leave just "100-150/300". The numbers/characters and text length change. Let me know if you need more information to help. Thank you.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Macro to strip text from cell.

    for i=1 to len(strCellContents)
        if isnumeric(mid(strCellContents,i,1) or mid(strCellContents,i,1)="/" then
            strOutput=strOutput & mid(strCellContents,i,1) 
       end if
    next i
    then use strOutput
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    09-24-2014
    Location
    FL, USA
    MS-Off Ver
    Office 2010
    Posts
    18

    Re: Macro to strip text from cell.

    Thank you again for the quick reply. With some slight tweaking that got me what I needed.

+ 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. [SOLVED] Macro to strip out items in text file and paste into columns
    By reesjordan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-16-2014, 01:16 PM
  2. [SOLVED] How do I strip punctuation from end of text?
    By egavasrg in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-07-2011, 04:26 AM
  3. How to strip text from a cell
    By gurp99 in forum Excel General
    Replies: 11
    Last Post: 01-29-2011, 06:38 PM
  4. Strip text in cell
    By buddhajb in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-30-2008, 01:47 PM
  5. Strip text before character
    By bell23 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-29-2005, 06:05 AM

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