Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to do the following with this procedu
1. In the current worksheet, starting at a specific row, cycle through each each and match with a defined range in a lookup workbook named "expttl". If the cell value is a match or "" then continue until it finds a non match. When if finds a nonmatch return the column value of cell. 2. I'm having difficulty with the Set RngA = Workbooks("LookupWorkbook").Sheets("LookupWorsheet ").Range line. Any ideas. TIA Function FindColumn() As Long On Error GoTo Proc_Err Dim fStart As Boolean Dim lngHeader As Long Dim lngX As Long Dim strCell As String Dim RngA As Range Dim wks As Worksheet Dim res As Variant fStart = False lngX = 1 Do Until fStart = True strCell = Cells(lngHeader, lngX).Value 'If cell is blank assign as date and is ignored If strCell = "" Then strCell = "Date" Else End If 'Trim spaces on either slide strCell = RTrim(LTrim(strCell)) 'Reference the Export Set RngA = Workbooks("LookupWorkbook").Sheets("LookupWorsheet ").Range("LookupRange") res = 0 res = Application.WorksheetFunction.Match(strCell, RngA, 0) If IsError(res) Then fStart = True FindVendorStart = lngX Exit Function Else End If lngX = lngX + 1 Loop Proc_Exit: Exit Function Proc_Err: Select Case Err.Number Case 1004 FindVendorStart = lngX Case Else Debug.Print Err.Number & " - " & Err.Description End Select Resume Proc_Exit End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Lookup Formula: Return 1st match, then 2nd match, then 3rd match | Excel Discussion (Misc queries) | |||
Lookup? Match? pulling rows from one spreadsheet to match a text f | Excel Worksheet Functions | |||
Index,Match table array in separate workbook | Excel Worksheet Functions | |||
Select sheet tabs in workbook & save to separate workbook files | Excel Worksheet Functions | |||
Lookup worksheet name in separate workbook | Excel Discussion (Misc queries) |