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. |
selection.find shortening the procedure by skipping the "activate" part
Peter Is this what you are after r = Range("B3:B1000").Find( _ What:=IDs(Element), _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlPart, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False).Ro -- mudrake ----------------------------------------------------------------------- mudraker's Profile: http://www.excelforum.com/member.php...nfo&userid=247 View this thread: http://www.excelforum.com/showthread.php?threadid=27722 |
All times are GMT +1. The time now is 02:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com