Thread: Dim and set
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Zack Barresse[_3_] Zack Barresse[_3_] is offline
external usenet poster
 
Posts: 101
Default Dim and set

Hello David,

You do not need to Set anything except Objects, which String is not. Here
is an example of what you could use ...

Dim rngCell As Range
Dim SerialNumber As String
SerialNumber = ActiveCell.Offset(1, 3).Value & ActiveCell.Offset(1,
4).Value
Set rngCell = Selection.Find(What:=SerialNumber, LookIn:=xlFormulas,
LookAt:=xlWhole)
If Not rngCell Is Nothing Then
rngCell.Activate
Else
MsgBox

HTH

--
Regards,
Zack Barresse, aka firefytr
To email, remove NOSPAM


"David" wrote in message
...
Hi Group,

I am having trouble with the follwing. When I try and find, it says it is
not set.
Dim SerialNumber As String
Set SerialNumber = ActiveCell.Offset(1, 3).Value & ActiveCell.Offset(1,
4).Value
Selection.Find(What:=SerialNumber, After:=ActiveCell, LookIn:=xlFormulas,
_
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

I tried the last statement with the Variable SerialNumber in ( ), but it
still says it is not set.

Thanks
--
David