Kamis, 19 Januari 2017

Re: [ExcelVBA] Conditional Formatting using formula (operator Between)

 



Have you tried recording a macro of yourself setting these conditional formats manually?  Compare this with your code to find any fundamental problems.  Also, have you looked at what conditional formatting is actually set up for the cells when you run this code?
 
Otherwise, it might be worth uploading your spreadsheet to the files area so people can have a fiddle with it.

Regards, Dave S
 
----- Original Message -----
Sent: Friday, January 20, 2017 6:45 AM
Subject: [ExcelVBA] Conditional Formatting using formula (operator Between)

I have been trying to use this code to format cells that are greater than 0 but less than 1 with 3 decimal places. After researching I thought this might work after running this sub the formatting has not changed. Any ideas?


    lastrow = Worksheets("Sheet1").Range("J2").End(xlDown).Row


    Range("J3:J" & lastrow).Select


    With Range("J3:J" & lastrow)

        .FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _

        Formula1:="=0", Formula2:="=0.999"

        With .FormatConditions(.FormatConditions.Count)

            .SetFirstPriority

            With .NumberFormat = "0.000"

            End With

        End With

    End With


End Sub


__._,_.___

Posted by: "David Smart" <smartware.consulting@gmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.

----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------

.

__,_._,___

Tidak ada komentar:

Posting Komentar