B
Ben
Hi all,
This is a repost from last Friday, but not sure why I didn't see my earlier
post in the newsgroup. Here's my question:
I pass to the below routine to an Excel object and want to look for some
value in the cell, but when execution reaches to the find statement, I got an
error:
Run-time error '91'
Object variable or With block variable not set
I looked at the code for quite a while and couldn't see the reason why,
perhaps another set of eyes will see what I am missing. Thanks for your help.
sub Test (ByRef oWkbk As Excel.Workbook)
Dim oWksh As Excel.Worksheet
Set oWksh = oWkbk.ActiveSheet
oWksh.Range("A1").Select
Selection.End(xlDown).Select
dLastRow = oWkbk.Parent.ActiveCell.Row
oWksh.Cells.Find(What:="FindSomething", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
end sub
Ben
--
This is a repost from last Friday, but not sure why I didn't see my earlier
post in the newsgroup. Here's my question:
I pass to the below routine to an Excel object and want to look for some
value in the cell, but when execution reaches to the find statement, I got an
error:
Run-time error '91'
Object variable or With block variable not set
I looked at the code for quite a while and couldn't see the reason why,
perhaps another set of eyes will see what I am missing. Thanks for your help.
sub Test (ByRef oWkbk As Excel.Workbook)
Dim oWksh As Excel.Worksheet
Set oWksh = oWkbk.ActiveSheet
oWksh.Range("A1").Select
Selection.End(xlDown).Select
dLastRow = oWkbk.Parent.ActiveCell.Row
oWksh.Cells.Find(What:="FindSomething", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
end sub
Ben
--