+ Reply to Thread
Results 1 to 16 of 16

How to select all text items, but not text numbers

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,126

    How to select all text items, but not text numbers

    My title say it all. Using VBA how do I select all text that's NOT a text number?
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,308

    Re: How to select all text items, but not text numbers

    What "select all text items" mean for you ?
    Are they maybe text strings in cells or e.g. in text fields ?

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,126

    Re: How to select all text items, but not text numbers

    By text I mean a string like "Bobby" or "100FGB-254" or "IBM" or anything containing a text item.
    By numbers vs Text Numbers I mean 1000, not '1000

    I'm not sure I know what Text Fields are in Excel.

  4. #4
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,308

    Re: How to select all text items, but not text numbers

    Is this data in a specific range of sheet cells ?
    Can this range (if any) be predetermined (a priori), or will it be unknown ?

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,126

    Re: How to select all text items, but not text numbers

    It will be whatever range I select at the time, probably a single column, but possibly the entire sheet.

  6. #6
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,308

    Re: How to select all text items, but not text numbers

    Quote Originally Posted by jomili View Post
    ... text ... "Bobby" or "100FGB-254" or "IBM" or anything containing a text item.
    By numbers vs Text Numbers I mean 1000, not '1000
    This number/text/string/item "100fff" is also "Text Number", this is hexadecimal "1052671"

    Attach an example with more data and show what is what.

  7. #7
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: How to select all text items, but not text numbers

    You can highlight numbers or text using the TYPE() function

  8. #8
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,126

    Re: How to select all text items, but not text numbers

    Arthurbr,
    See the attached. Text is Type 2, and TextNumbers are Type 2. So "Type" doesn't differentiate between Text and Text Numbers. In any list of numbers and text numbers I can use the ISNUMBER function to determine which is a Number, but that still don't give me there, because ISNUMBER doesn't differentiate between Text and TextNumbers either.

    I have two simple macros below, to select all Text value or to Select all Numeric values. TextNumbers are in a unique class between these two, in some cases they can considered numbers, in some cases they can be considered Text. So my dilemma is, how do I select only the TextNumbers?

    Please Login or Register  to view this content.
    Attached Files Attached Files

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

    Re: How to select all text items, but not text numbers

    You mean like this?
    Please Login or Register  to view this content.

  10. #10
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,126

    Re: How to select all text items, but not text numbers

    Jindon,
    Your macro selected only the numbers. What I want to select are only the TextNumbers.

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

    Re: How to select all text items, but not text numbers

    Then the other way around
    Please Login or Register  to view this content.

  12. #12
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,108

    Re: How to select all text items, but not text numbers

    You could loop and use Excel's error checking:

    Please Login or Register  to view this content.
    To exclude the text numbers, just change the error test to False instead of True.
    Everyone who confuses correlation and causation ends up dead.

  13. #13
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,126

    Re: How to select all text items, but not text numbers

    Nope that selects all the Text, both Textvalues (words) and TextNumbers. Only want to select TextNumbers.

    The only way I can figure to do it is to text each individual cell. If TYPE is text, and cell.value*1 is a number (or doesn't produce an error) then it's a TextNumber. But how could we do this so it would operate on a large range quickly?

  14. #14
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,126

    Re: How to select all text items, but not text numbers

    Rorya,

    I think you're done it! I've never seen that "xlNumberAsText" property before. Where does that come from? And THANK YOU!

  15. #15
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,108

    Re: How to select all text items, but not text numbers

    It's one of Excel's built-in error checking options.

  16. #16
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,126

    Re: How to select all text items, but not text numbers

    Rorya,
    You've just opened a new world for me. I never thought of using the error-checking properties to distinguish special cells/conditions. Thanks for showing me this!

+ 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. VBA to convert a range from numbers to numbers stored as text (Text to Columns)
    By tantcu in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-06-2017, 05:50 PM
  2. [SOLVED] Text Box After press enter i want to select all text of a textbox (userform)
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-17-2017, 01:19 AM
  3. [SOLVED] SELECT Column with Numbers and Text JET-SQL
    By k64 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-15-2015, 12:50 PM
  4. [SOLVED] How to find text then select RANGE form the text found to lastrow of Column J
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2014, 02:45 AM
  5. Select top 3 items from an array of numbers
    By Tesleem in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-11-2012, 07:53 AM
  6. Replies: 6
    Last Post: 02-23-2012, 09:56 AM
  7. Select & Delete text in TextBox1 also deletes text in TextBox2
    By heinousanus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-10-2006, 08:02 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