ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Find Method (https://www.excelbanter.com/excel-programming/326971-excel-find-method.html)

JonWayne

Excel Find Method
 
I get the error, "Unable to get the Find property of the Range class",
whenever I use the Find method in Excel VBA. This is my usage:

Set rngTemp = rngCol1.Find("Party Name:", "A1", xlValues, xlPart, xlByRows,
xlNext, False)

Any ideas?



RB Smissaert

Excel Find Method
 
This works with me:

Sub test()

Dim rngCol As Range
Dim rng As Range

Set rngCol = Columns(1)

Set rng = rngCol.Find(What:="test", _
After:=Cells(1), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)

If Not rng Is Nothing Then
MsgBox rng.Address
End If

End Sub

RBS



"JonWayne" wrote in message
. ..
I get the error, "Unable to get the Find property of the Range class",
whenever I use the Find method in Excel VBA. This is my usage:

Set rngTemp = rngCol1.Find("Party Name:", "A1", xlValues, xlPart,
xlByRows,
xlNext, False)

Any ideas?




Tom Ogilvy

Excel Find Method
 
Are you using Excel 97 and executing this from a commandbutton? If so
change the TakeFocusOnClick property of the commandbutton to False.

--
Regards,
Tom Ogilvy


"JonWayne" wrote in message
. ..
I get the error, "Unable to get the Find property of the Range class",
whenever I use the Find method in Excel VBA. This is my usage:

Set rngTemp = rngCol1.Find("Party Name:", "A1", xlValues, xlPart,

xlByRows,
xlNext, False)

Any ideas?





Tom Ogilvy

Excel Find Method
 
Looking a little closer at your code it should probably be:

Set rngTemp = rngCol1.Find("Party Name:", rngCol1(1), _
xlValues, xlPart, xlByRows,xlNext, False)

--
Regards,
Tom Ogilvy


"JonWayne" wrote in message
. ..
I get the error, "Unable to get the Find property of the Range class",
whenever I use the Find method in Excel VBA. This is my usage:

Set rngTemp = rngCol1.Find("Party Name:", "A1", xlValues, xlPart,

xlByRows,
xlNext, False)

Any ideas?






All times are GMT +1. The time now is 06:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com