+ Reply to Thread
Results 1 to 4 of 4

Help with Function to Find the Next Row in a Column with Specific Criteria [Excel 2007]

  1. #1
    Registered User
    Join Date
    11-01-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    6

    Help with Function to Find the Next Row in a Column with Specific Criteria [Excel 2007]

    Hello everyone,

    I am having an issue with a function I have made in Excel 2007 and could use some assistance.

    This function needs to be able to scan a column, either above or below the cell it's active in, to find the next closest cell with data in it. Furthermore, it needs to be able to exclude some data or text in certain cases, as well as search of for specific data or text. It should return the row number of the desired cell, not the contents.

    I have attached a sample sheet which shows a few different cases and the desired output of a few examples. Attachment 374065

    Below is my function, which works perfectly when I test it by calling it with a macro, it gives me an error (#VALUE) when I try to run it from the sheet. The issue appears to be related to the address/range input.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Help with Function to Find the Next Row in a Column with Specific Criteria [Excel 2007

    The problem is buried down probably here:
    Please Login or Register  to view this content.
    while Activecell is well defined when funcion is called from within another sub or function in VBA it is wrong when called as UDF from the cell.

    Have a closer look on:
    Please Login or Register  to view this content.
    2 additional comments - variable limit is not defined (you can live with it, it is like defined as Variant
    - end if is mising in last if - this is for sure a serious problem.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    11-01-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Help with Function to Find the Next Row in a Column with Specific Criteria [Excel 2007

    Thank you. I will look at your suggestion and give it a try. Not sure why the End If didn't post? I was trying to clean up the formatting a bit before posting here. I may have hit backspace one too many times.

  4. #4
    Registered User
    Join Date
    11-01-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Help with Function to Find the Next Row in a Column with Specific Criteria [Excel 2007

    That was it! Thank you so much for the help. I've found it's often small oversights that cause the issue...

    Here's the full code, working as it should, if anyone would like it.

    Please Login or Register  to view this content.
    Thanks again.

+ 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. Excel 2007 : Find out Maximum date with two criteria
    By avk in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 08-11-2013, 06:18 PM
  2. Excel 2007 - Counting of blank cells with specific criteria
    By nishu.raghavendra in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-16-2013, 09:46 AM
  3. How to freeze a specific row/column (excel 2007)
    By cmf0106 in forum Excel General
    Replies: 3
    Last Post: 11-02-2009, 11:06 PM
  4. Replies: 2
    Last Post: 03-30-2009, 04:04 AM
  5. Find function in specific column
    By MasterMonk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-12-2007, 02:25 PM

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