Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem using "Find" WorksheetFunction in Excel VBA

I'm trying to use the "Find" WorksheetFunction to hide all rows that d
not contain a predefined string (Initials) in column C. I keep gettin
the error:

Run-time error '1004':
Unable to get the Find property of the WorksheetFunction class

In Excel, this function returns #VALUE if the string you are lookin
for is not found, but in VBA I am encountering this error whether th
string is (or should be) found or not.

Dim FindVal as Double
Dim Initials as String
Dim N as Variant
Dim CellRef as Variant

For N = 5 to 300

CellRef = "C" & N
Initials = "GW" 'this is passed from another procedure

On Error Resume Next
FindVal = WorksheetFunction.Find(Initials, CellRef)
If Err.Number = 1004 Then
Worksheets("name").Rows(N).Hidden = True
End if

Next

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Problem using "Find" WorksheetFunction in Excel VBA

Can you not use Range.Find instead?

Jeff

"Frank Kabel" wrote in message
...
Hi
FIND is not supported within VBA. Use the InStr method insetad (see VBA
help for about this method)

--
Regards
Frank Kabel
Frankfurt, Germany


I'm trying to use the "Find" WorksheetFunction to hide all rows that
do not contain a predefined string (Initials) in column C. I keep
getting the error:

Run-time error '1004':
Unable to get the Find property of the WorksheetFunction class

In Excel, this function returns #VALUE if the string you are looking
for is not found, but in VBA I am encountering this error whether the
string is (or should be) found or not.

Dim FindVal as Double
Dim Initials as String
Dim N as Variant
Dim CellRef as Variant

For N = 5 to 300

CellRef = "C" & N
Initials = "GW" 'this is passed from another procedure

On Error Resume Next
FindVal = WorksheetFunction.Find(Initials, CellRef)
If Err.Number = 1004 Then
Worksheets("name").Rows(N).Hidden = True
End if

Next N


---
Message posted from http://www.ExcelForum.com/




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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How to change the default in Excel from "find next" to "find all" igs Excel Discussion (Misc queries) 0 November 27th 06 06:20 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
VBA: "Volatile" use of concatenated worksheetfunction expression Factivator Excel Programming 2 June 29th 04 04:30 PM


All times are GMT +1. The time now is 03:51 AM.

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

About Us

"It's about Microsoft Excel"