+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18

Thread: A more efficient code for custom function

  1. #16
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007, 2010
    Posts
    25,772

    Re: A more efficient code for custom function

    Try running in memory:

    Function ValueAtRight(sInp As String) As Variant
        Dim rInp        As Range
        Dim avInp       As Variant
        Dim iRow        As Long
    
        With Worksheets("NAME2")
            Set rInp = Intersect(.Columns(1), .UsedRange)
        End With
    
        avInp = rInp.Value2
        
        For iRow = 1 To rInp.Rows.Count
            If InStr(avInp(iRow, 1), sInp) Then
                ValueAtRight = rInp(iRow, 2)
                Exit Function
            End If
        Next iRow
    End Function
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  2. #17
    Registered User
    Join Date
    08-23-2010
    Location
    Arizona, USA
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: A more efficient code for custom function

    It changes every 1-3 days

  3. #18
    Registered User
    Join Date
    08-23-2010
    Location
    Arizona, USA
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: A more efficient code for custom function

    i have tried to implement your function without any success. Here is a sample workbook attached. you can run the macro and see its functionality. thanks
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0