View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Prince Prince is offline
external usenet poster
 
Posts: 7
Default Find function for a Range failing in excel 2003 and giving subscriptout of range error 9 problem but works fine in excel 2000

Set mwbStore = Application.Workbooks.Add()
For n = 0 To UBound(mwbD)
For Each wks In mwbD(n).Worksheets
Set rng = wks.UsedRange.Columns(1)
Set cel = Nothing
*******Problem Line
Set cel = rng.Find(What:=storeNum, LookAt:=xlWhole, _
LookIn:=xlValue,
SearchOrder:=xlByColumns)
*****End Problem Line

The basic thing is that in a workbook BUDGET1 sheet we are having
first column as store names defind as a range.

It is picking the store name and trying to find that store name in
that first column defined as range in BUDGET1 sheet.

The same function

Set cel = rng.Find(What:=storeNum, LookAt:=xlWhole, _
LookIn:=xlValue,
SearchOrder:=xlByColumns)

is running fine in excel 2000 but gives Subscript out of range error 9
in excel 2003