+ Reply to Thread
Results 1 to 2 of 2

Proxy Conditional Formatting Function

  1. #1
    Registered User
    Join Date
    09-17-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    4

    Proxy Conditional Formatting Function

    I have been trying to include some sort of conditional formatting within the function code in Excel. However, I am having trouble getting it to work. Anyone have any idea why the code below will not work:

    Function Compare(First As Double, Second As Double)

    Dim Row As Integer
    Dim Col As Integer

    ActiveCell.Select

    If ((First - Second) > 0.1) Or ((First - Second) < -0.1) Then

    Compare = "ERROR"
    ActiveCell.Interior.ColorIndex = 3
    ActiveCell.Interior.Pattern = xlSolid

    Else

    Compare = "OK"

    End If

    End Function

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Proxy Conditional Formatting Function

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

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.6.0 RC 1