Results 1 to 2 of 2

i'm a klutz

Threaded View

  1. #1
    Registered User
    Join Date
    03-20-2012
    Location
    NC
    MS-Off Ver
    Excel 2007
    Posts
    24

    i'm a klutz

    I'm sure this can be done better. Thisdate is a set of dates in, say a1 to a100. in b1 to b100 there are values [the val range]. I'm trying to return the value in val that corresponds to thisdate matching startdate.

    this code produces an error.

       Function INIT(THISDATE As Range, STARTDATE As Date, VAL As Range)
       Dim C, B
       Dim ICOUNT As Integer, MAX As Integer
       Dim ARR1()
       Dim ARR2()
        MAX = THISDATE.Count
        ReDim ARR1(1 To MAX)
        ReDim ARR2(1 To MAX)
        
       ARR1 = Array(THISDATE)
       ARR2 = Array(VAL)
       For ICOUNT = 1 To MAX
        If DateValue(ARR1(ICOUNT)) = STARTDATE Then
            INIT = ARR2(ICOUNT)
            Exit Function
            End If
            Next ICOUNT
       End Function
    Last edited by arlu1201; 06-01-2012 at 02:29 AM. Reason: Please use code tags in future.

Thread Information

Users Browsing this Thread

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

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