Results 1 to 12 of 12

Combining Two Functions

Threaded View

  1. #1
    Registered User
    Join Date
    07-28-2015
    Location
    Danville, IL USA
    MS-Off Ver
    2013
    Posts
    34

    Combining Two Functions

    First let me say that I'm a novice at VBA.

    I have a function called ColorCheck3 that looks at the referenced cell below it and returns a text string. I call it out by putting in cell A1 "=ColorCheck3(A2). It works fine until I start filtering (hiding) the rows below it.

    I have another function called NextVis that correctly finds the next visible row below it. I call it out by putting in cell A1 "=NextVis(A2)". As I hide the rows below 1 it properly detects the next visible cell in column A.

    I've been trying in vain to use NextVis to get ColorCheck3 to look at the next visible cell below it. Here's my code:

    Function CheckColor3(Range)
        If Range.Interior.Color = RGB(189, 215, 238) Then
            CheckColor3 = "Peer"
        ElseIf Range.Interior.Color = RGB(248, 203, 173) Then
            CheckColor3 = "Child"
        ElseIf Range.Interior.Color = RGB(198, 224, 180) Then
            CheckColor3 = "Child"
        Else
            CheckColor3 = ""
        End If
    End Function
    
    
    Function NextVis(Target)
    If VarType(Target) = vbString Then
        Set Target = Range(Target)
    End If
    Set rtest = Target.Offset(1, 0)
    Do
    If Not rtest.EntireRow.Hidden Then
        NextVis = rtest.Value
        Exit Do
    End If
    If rtest.Row = 1 Then
        NextVis = rtest.Value
        Exit Do
    End If
    Set rtest = rtest.Offset(1, 0)
    Loop While NextVis = ""
    End Function
    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer



    Is there a way to get ColorCheck3 to use NextVis as it range? Or am I just going about this in the completely wrong way?

    Thanks in advance for any help.
    Last edited by 6StringJazzer; 07-29-2015 at 11:44 AM. Reason: code tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Combining multiple functions>lookup/sum functions
    By mush106 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-22-2013, 07:47 AM
  2. Combining two functions
    By ram09 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-24-2013, 01:57 PM
  3. Excel 2007 : Combining functions
    By Petest67 in forum Excel General
    Replies: 2
    Last Post: 03-24-2012, 03:06 PM
  4. Combining If & And functions
    By marielav99 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-27-2010, 10:30 AM
  5. Excel 2007 : Combining IF Functions together....
    By qhx398 in forum Excel General
    Replies: 6
    Last Post: 12-11-2009, 03:35 AM
  6. Combining IF functions
    By NeilM442 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-10-2009, 01:02 PM
  7. Combining IF functions
    By rlkerr1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-14-2007, 03:20 PM
  8. [SOLVED] Combining IF & AND functions
    By Khoshravan in forum Excel General
    Replies: 1
    Last Post: 08-04-2006, 12:16 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