+ Reply to Thread
Results 1 to 3 of 3

Vba code for conditional format

  1. #1
    Registered User
    Join Date
    05-19-2016
    Location
    Greece
    MS-Off Ver
    2007
    Posts
    2

    Vba code for conditional format

    I want the vba code to format the cells of workbook like this:
    if the number entered in cells is greater or equal to 1 to have 2 digits for integer and 1 for float( NumberFormat="00.0". Example 02.3)
    And if number is lower than 1 Numberformat="0.0". Example 0.8)

    Thank you in advance

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Vba code for conditional format

    It would probably be better to do this with conditional formatting. You would choose "Format only cells that contain" then use a Custom format for numbers >= 1. (Numbers <1 are using the default format so nothing special is needed for those.)

    nnanos CF.jpg
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    05-19-2016
    Location
    Greece
    MS-Off Ver
    2007
    Posts
    2

    Re: Vba code for conditional format

    Quote Originally Posted by 6StringJazzer View Post
    It would probably be better to do this with conditional formatting. You would choose "Format only cells that contain" then use a Custom format for numbers >= 1. (Numbers <1 are using the default format so nothing special is needed for those.)

    Attachment 461654
    I know how to do this way but it is imposible because i create new excel files using vba code and i want code to be put inside the code of creation!
    Last edited by nnannos; 05-19-2016 at 02:07 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. Put a conditional format into a LastRow code
    By WasWodge in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-27-2011, 12:00 AM
  2. Conditional Formatting Code - Deletes Wrong Conditional Format
    By RSpecianJr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2010, 10:53 AM
  3. Macro code for conditional format
    By herukuncahyono in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-24-2009, 08:39 PM
  4. [SOLVED] VB Code To Conditional Format > 4 arguements
    By VCSGroup in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2005, 05:50 PM
  5. [SOLVED] VB Code to Conditional Format a Cell Range
    By VCSGroup in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-08-2005, 05:35 PM
  6. [SOLVED] Code for Conditional format
    By TUNGANA KURMA RAJU in forum Excel General
    Replies: 4
    Last Post: 11-03-2005, 06:00 AM
  7. Conditional Format w/ row highlight code
    By Adria D. in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2005, 10:05 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