Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help with find macro.


hi i am getting an error message of "runtime 91: Object variable or with
block variable not set"

this is my code:

Sub test2()
Dim cell As Object
Dim strFileFound As String
For Each cell In Range("a11:a56")

cell.Activate
Range("i11").Select
Selection.CurrentRegion.Select
strFileFound = Selection.Find(what:=ActiveCell.Value & " for " &
Range("e4").Value, LookIn:=xlValues, lookat:=xlPart).Value
If strFileFound < "" Then ActiveCell.Offset(0, 1).Value = "Found"
Beep
Next cell
End Sub

It keeps on highlighting the line which starts with "strfilefound..."


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=538409

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default help with find macro.

Sub test2()
Dim cell As Object
Dim rng as Range
For Each cell In Range("a11:a56")

Range("i11").Select
Selection.CurrentRegion.Select
set rng = Selection.Find(what:=Cell.Value & " for " & _
Range("e4").Value, LookIn:=xlValues, lookat:=xlPart)
If not rng is nothing then _
cell.Offset(0, 1).Value = "Found"
beep
Next cell
End Sub

--
Regards,
Tom Ogilvy


"funkymonkUK" wrote:


hi i am getting an error message of "runtime 91: Object variable or with
block variable not set"

this is my code:

Sub test2()
Dim cell As Object
Dim strFileFound As String
For Each cell In Range("a11:a56")

cell.Activate
Range("i11").Select
Selection.CurrentRegion.Select
strFileFound = Selection.Find(what:=ActiveCell.Value & " for " &
Range("e4").Value, LookIn:=xlValues, lookat:=xlPart).Value
If strFileFound < "" Then ActiveCell.Offset(0, 1).Value = "Found"
Beep
Next cell
End Sub

It keeps on highlighting the line which starts with "strfilefound..."


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=538409


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help with find macro.


Many thanks Tom that worked great thank you


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=538409

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
Macro-find and sum puiuluipui Excel Discussion (Misc queries) 5 October 19th 09 01:44 AM
Get Macro warning, but can't find Macro Stilla Excel Worksheet Functions 1 January 20th 07 01:27 AM
change error message when no more for "find" in macro to find swyltm Excel Programming 1 January 13th 06 05:16 PM
Using Find in a macro Phil Osman Excel Discussion (Misc queries) 2 August 9th 05 02:08 AM
I need to find a macro to find data cut and paste to another colu. Rex Excel Programming 6 December 7th 04 09:22 AM


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