Results 1 to 3 of 3

Identify a worksheet from a provided range

Threaded View

  1. #1
    Registered User
    Join Date
    06-03-2014
    MS-Off Ver
    2013
    Posts
    10

    Identify a worksheet from a provided range

    Hello,

    I'm going to try and explain myself here...

    I have the below function:
    Public Function HPROGDATE(Criteria As Range, HeaderRow As Integer)
    
    Dim C As Range
    Dim progress As String
    progress = ""
    
    For Each C In Criteria.Cells
        If C.Value <> "" Then progress = Mid(C.Address, 2, 1)
    Next C
    
    If progress <> "" Then HPROGDATE = Sheets("Progress_Tracker").Range(progress & Headerrow).Value
    
    
    End Function
    What this is doing is finding the latest entered value in a horizontal list, and returning the month (header row) this data was entered for.

    There's two issues with my code:

    1. to get the column from the Cell that has been updated, i have had to use the MID function. i tried using C.Column, but i didn't know how then to put that with the 'HeaderRow' variable that's passed in to identify the month. is there a tidier way of doing this?

    2. The function is currently used on 1 sheet within a workbook, but the function automatically updates whenever something changes in the workbook. As the Criteria is passed in, it 'knows' that the range is on the 'Progress_Tracker' sheet. however i have had to explicitly state that sheet when returning my value, otherwise it uses the active sheet at the time of update. is there a way to identify the 'sheet' from the 'Criteria' range?

    The formula appears in the worksheet as =HPROGDATE($D$4:$M$4,3)

    edit - changed to solved
    Last edited by Optional_karl; 02-09-2015 at 08:31 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] COUNTIF Time Range - Time Range provided in Cells
    By Eaks77 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-02-2015, 11:12 PM
  2. [SOLVED] VBA Code to Compare worksheet 1 to Worksheet 2 and identify differences
    By mab1284 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-04-2013, 03:24 PM
  3. Find the MONTH in a range when we're provided the entire date
    By Habanero Time in forum Excel General
    Replies: 7
    Last Post: 01-23-2012, 09:50 PM
  4. How to Identify patterns in worksheet?
    By TheGovernor11 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-03-2011, 04:29 AM
  5. Cell Ref to identify worksheet
    By Mikeice in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2005, 11:05 AM

Tags for this Thread

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