Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find generates error message

Can anyone tell me why the following code

With xlSHT.Range("c1")
Set c = .Find(sName, "c1", xlValues, , xlByColumns, xlNext)
End With

Generates the error message: "unable to get the find property of the Range
class"

xlSHT is a worksheet object that has been set to a worksheet in an open
workbook. "c" is a range object. Any help would be greatly appriciated.

Jim


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Find generates error message

Try:

Set c = .Find(sName, Range("C1"), xlValues, , xlByColumns, xlNext)

The second argument should be a range, not a range address.

--

Vasant


"James Houston" wrote in message
...
Can anyone tell me why the following code

With xlSHT.Range("c1")
Set c = .Find(sName, "c1", xlValues, , xlByColumns, xlNext)
End With

Generates the error message: "unable to get the find property of the Range
class"

xlSHT is a worksheet object that has been set to a worksheet in an open
workbook. "c" is a range object. Any help would be greatly appriciated.

Jim




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Find generates error message

You have two problems it seems to me. One is that your With statement
limits the Find to one cell: C1. I assume you want to search more than that
one cell. Second, the Find method's second argument is a range; you have a
string ("c1").

So maybe you want something like this:

Sub test()
Dim c As Range
Dim xlSHT As Worksheet
Dim sName As String
Set xlSHT = ActiveSheet
sName = "abc"
With xlSHT
Set c = Cells.Find(sName, .Range("C1"), xlValues, , xlByColumns,
xlNext)
End With
If Not c Is Nothing Then MsgBox c.Address
End Sub


--
Jim Rech
Excel MVP
"James Houston" wrote in message
...
| Can anyone tell me why the following code
|
| With xlSHT.Range("c1")
| Set c = .Find(sName, "c1", xlValues, , xlByColumns, xlNext)
| End With
|
| Generates the error message: "unable to get the find property of the Range
| class"
|
| xlSHT is a worksheet object that has been set to a worksheet in an open
| workbook. "c" is a range object. Any help would be greatly appriciated.
|
| Jim
|
|


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlink selection generates error message cwpauline Links and Linking in Excel 2 October 18th 08 04:04 AM
Disable find files error message for missing links on opening WB RAZA Excel Discussion (Misc queries) 3 May 10th 06 12:32 PM
cutting and pasting rows from one sheet to another generates error JT Spitz Excel Discussion (Misc queries) 7 February 14th 06 07:06 PM
Excel Analysis Add-in EOMONTH generates #NAME? error Ray Excel Worksheet Functions 6 July 18th 05 07:00 PM
Copy generates an automation error. Richard[_24_] Excel Programming 1 January 16th 04 12:37 PM


All times are GMT +1. The time now is 04:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"