LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Dim and set

Hi,

Remove the Activate method when you are making an assignment.

Set rngFound = Cells.Find(What:="9C4754", After:=ActiveCell, _
LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)

Cheers
Andy

David wrote:
I am still failing and I guess it is because I have not enclosed all the
code, so the problems must be somewhere else:
Sub TaylorFarm()
' Macro1 Macro
' Macro recorded 3/23/2006 by David Lanman
Range("A1").Select
Dim SerialNumber As String
Dim rngFound As Range
Cells.Find(What:="Equipment", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
EquipmentID = ActiveCell.Offset(1, 0).Value
If EquipmentID = "" Then
SerialNumber = ActiveCell.Offset(1, 3).Value & ActiveCell.Offset(1,
4).Value
Sheets("TAYLORSerNo").Select
Range("A1").Select
Set rngFound = Cells.Find(What:="9C4754", After:=ActiveCell, _
LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
If rngFound Is Nothing Then
MsgBox "Sorry, not found"
Else
rngFound.Select
End If
Else
Stop
End If
Cells.FindNext(After:=ActiveCell).Activate
End Sub

It fails when I try and do the Find "Set rngFound =". It is hardcoded here,
but I would be using the variable SerialNumber.

Thanks for your help.


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
 
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



All times are GMT +1. The time now is 08:35 PM.

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"