+ Reply to Thread
Results 1 to 2 of 2

i'm a klutz

Hybrid View

jalea148 i'm a klutz 05-31-2012, 07:04 PM
arlu1201 Re: i'm a klutz 06-01-2012, 02:30 AM
  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.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: i'm a klutz

    Jalea148,


    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem. Once you have done this please send me a PM and I will remove this request.

    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

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