View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Peter[_21_] Peter[_21_] is offline
external usenet poster
 
Posts: 35
Default selection.find shortening the procedure by skipping the "activate" part

Hello everyone,

In a macro I have this piece of code of which I know a shorter version can
be implemented (but I don't know how exactly). It has to do something with
omitting the "activate" part of it, and directly placing the desired values
(the row and column numbers) into the variables, I believe by using the Set
statement. Exactly how, I'd like to know from you:

Code:
For Element = 1 To UBound(IDs)
Range("B3:B1000").Select
Selection.Find( _
What:=IDs(Element), _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False).Activate

r = ActiveCell.Row

Rows(2).Select
Selection.Find( _
What:=Month, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False).Activate

c = ActiveCell.Column

usage: both win xp/office 2003 (home) and
win2000 / office2000 (at the office)

TIA,
Peter.