Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have passed a range of data to a variable (PMSMatchRange) that I have
dimensioned as an Object. My first For Next loop below works correctly. However when I get into my second For Next Loop, I cannot seem to use the Offset Method on the PMSMatchRange variable: CorrectCompanyName = PMSMatchRange.Offset(MatchNumber - 1, 1) Is this because it is an object? Effectively I am tyring to do a lookup off 1 column to the right of the range that I passed to this variable. Thanks ImportSheetVbNm.Select ImportSheetVbNm.Range("B2").Select ImportSheetVbNm.Range(Selection, Selection.End(xlDown)).Select NumPMSCodes = Selection.Rows.Count vbPMSCodeList.Select vbPMSCodeList.Range("A2").Select vbPMSCodeList.Range(Selection, Selection.End(xlDown)).Select Set PMSMatchRange = vbPMSCodeList.Range(Selection, Selection.End(xlDown)) For X = 1 To NumPMSCodes ImportSheetVbNm.Select ImportSheetVbNm.Range("B2").Offset(X - 1, 0).Select If IsError(Application.Match(ActiveCell.Value, PMSMatchRange, 0)) Then MsgBox ("You have PMS Codes in your import sheet that do not exist in your PMS Master List.") ActiveCell.EntireRow.Select Exit Sub End If Next For X = 1 To NumPMSCodes ImportSheetVbNm.Select ImportSheetVbNm.Range("B2").Offset(X - 1, 0).Select MatchNumber = Application.WorksheetFunction.Match(ActiveCell.Val ue, PMSMatchRange, 0) CorrectCompanyName = PMSMatchRange.Offset(MatchNumber - 1, 1) ImportSheetVbNm.Range("C2").Offset(X - 1, 0) = CorrectCompanyName Next |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Runtime Error '91' Object variable or With block variable not set | Excel Discussion (Misc queries) | |||
Object Variable Not Set Error on Selection object | Excel Worksheet Functions | |||
Run-time error '91': "Object variable or With block variable not set | Excel Programming | |||
Cells.Find error Object variable or With block variable not set | Excel Programming | |||
Pivot Table - Object variable or with block variable not set? | Excel Programming |