+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    08-08-2009
    Location
    kilkenny,ireland
    MS-Off Ver
    Excel 2007
    Posts
    38

    min value with format

    hi there,
    I have numbers in column a3 to a24.when i press a button i want the min number to turn red.any help would be great.
    Last edited by giant; 03-18-2010 at 08:49 PM.

  2. #2
    Registered User
    Join Date
    08-08-2009
    Location
    kilkenny,ireland
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: min value with format

    hi there,
    I have numbers in column a3 to a24.when i press a button i want the min number to turn red.any help would be great.All the numbers are decimal values.Thanks

  3. #3
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    10,477

    Re: min value with format

    try
    Code:
    Sub colour()
    Dim mycell As Double
    mycell = Application.WorksheetFunction.Min(Range("A3:A24"))
    For Each c In Range("A3:A24")
    If c = mycell Then c.Interior.ColorIndex = 3
    Next c
    
    End Sub
    Mojito connoisseur and a dabbler in Cisco
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    08-08-2009
    Location
    kilkenny,ireland
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: min value with format

    martindwilson thank you works perfect.The numbers in the cells are constantly changing with each button click.So is it possible when i click again to make last red cell go back to normal and then next min number to color.

  5. #5
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    10,477

    Re: min value with format

    ok try
    Code:
    Sub colour()
    Dim mycell As Double
    mycell = Application.WorksheetFunction.Min(Range("A3:A24"))
    For Each c In Range("A3:A24")
    c.Interior.ColorIndex = xlNone
    If c = mycell Then c.Interior.ColorIndex = 3
    Next c
    
    End Sub
    Last edited by martindwilson; 03-18-2010 at 06:00 PM.
    Mojito connoisseur and a dabbler in Cisco
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Registered User
    Join Date
    08-08-2009
    Location
    kilkenny,ireland
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: min value with format

    martindwilson perfect thank you again.

Thread Information

Users Browsing this Thread

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

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