+ Reply to Thread
Results 1 to 5 of 5

Thread: Conditional formatting by formula or VB code

  1. #1
    Registered User
    Join Date
    06-09-2011
    Location
    Leeds, UK
    MS-Off Ver
    MS Office 2007
    Posts
    41

    Wink Conditional formatting by formula or VB code

    Hi ExcelGURUs,

    I have a spreadsheet where lots of conditional formatting are required.
    I want to do it using formula or VB code. For example in A column I have both number and text value (each value is coming from a vlookup formula from a diff tab of the same spreadsheet). I want to highlight only the numbers with a different colour.

    If anyone can help me with this….I can try the other requirements.

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Conditional formatting by formula or VB code

    Select the column A range and go to Format|Conditional Formatting, select Formula Is from drop down menu and enter formula: =ISNUMBER(A1+0)

    Click Format and select colour from the Pattern tab.

    Click Ok
    Click Ok to finish.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    06-09-2011
    Location
    Leeds, UK
    MS-Off Ver
    MS Office 2007
    Posts
    41

    Re: Conditional formatting by formula or VB code

    Thanks. This is working but 1 problem...it is highlighting the blank cell also…I don’t want the blank cell to be highlighted.

  4. #4
    Extremely Helpful member
    Join Date
    12-23-2006
    Location
    Belgium
    MS-Off Ver
    XL2003
    Posts
    6,127

    Re: Conditional formatting by formula or VB code

    Same method as NBVC but try =isnumber($a1)
    Quoting entire posts clutters the forum and makes threads hard to read !

    If you are pleased with a member's answer then use the Star icon to rate it

    Click here to see forum rules

  5. #5
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Conditional formatting by formula or VB code

    I added the +0, because usually when there is a mix of text and numbers, it could be that the numbers are text formatted.. the +0 forces the number to be a number, if indeed it has not alpha characters in it.... so arthurbr's method may or may not work...

    or you can try: =AND(A1<>"",ISNUMBER(A1+0))
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0