View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ExcelMonkey ExcelMonkey is offline
external usenet poster
 
Posts: 553
Default Lookup up active cell value in passed range

I want to check to see if a value of an active cell is contained in another
range of cells elsewhere in my spreadsheet. Bascially a Match. I am trying
to pass the list of values to a variable called PMSMatchRange. Then I am
looping thougth active cells and useing the Match function on the active cell
agains the master list. I originally thought I had to Dimension the
PMSMatchRange variable as an object but this is giving me a 424 Error Object
Required when it reaches the Set statement. What am I doing wrong?

Dim PMSMatchRange As Object
vbPMSCodeList.Select
vbPMSCodeList.Range("A2").Select
vbPMSCodeList.Range(Selection, Selection.End(xlDown)).Select

Set PMSMatchRange = vbPMSCodeList.Range(Selection,
Selection.End(xlDown)).Select

For X = 1 To NumPMSCodes
ActiveCell = Range("B2").Offset(X - 1, 0)
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.")
End If
Next