#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default find error

Hi,

I have this code and 2 problems;

Sheets("calendar").Activate
Dim foundcell As Range
Dim this
this = activecell.Value
Debug.Print this
Set foundcell = cells.find(what:=this, After:=activecell,
LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
True)
If foundcell Is Nothing Then
foundcell.Activate

As a test i have typed cow in 2 cells, and run the code with the first
"cow" cell selected.

The code errors on the foundcell.activate, run time error '91', object
variable or with block variable not set. It is obviously finding the
second "cow" but will not select it.

My second problem is if i change the cell vaues from cow to dates eg,
01/01/2008 the find does not work at all.

Thanks,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default find error

Apologies, I have adjusted my code so it is now correct and I no
longer get the error;

* * *If not foundcell Is Nothing Then
* * *foundcell.Activate


However why is my find not finding?! I can see plain as day the values
are there however it is not finding them.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default find error

It is possible that the setting MatchCase:= True could be the culprit. If
your What is not the same case as the target cells, then it will not return
them.

"anon" wrote:

Apologies, I have adjusted my code so it is now correct and I no
longer get the error;

If not foundcell Is Nothing Then
foundcell.Activate


However why is my find not finding?! I can see plain as day the values
are there however it is not finding them.

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
Error dialog box meaning and how to find error Jeanne Excel Worksheet Functions 2 September 4th 08 04:59 AM
Find error!!!! Is there any other way to do this? [email protected] Excel Programming 11 September 14th 07 05:44 PM
Find error!!!! Is there any other way to do this? [email protected] Excel Programming 0 September 14th 07 02:14 PM
help with this error-Compile error: cant find project or library JackR Excel Discussion (Misc queries) 2 June 10th 06 09:09 PM
change error message when no more for "find" in macro to find swyltm Excel Programming 1 January 13th 06 05:16 PM


All times are GMT +1. The time now is 08: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"