Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default VBA: Select Cell using find function and offset

I want a macro to find a value in a range and select the cell that matches
the find criteria, after the cell is selected I need it to offset down 20
rows.

Range("M3:IV3").Select
Selection.Find(What:="Rad", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
********Select Found Cell************
********Offset (Down) 20 Rows**************

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Select Cell using find function and offset

Sub offsetfind()
Range("M3:IV3").Find(What:="Rad", LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False).Offset(20).Activate
End Sub

But selections are not necessary
Sub offsetfindandplacevalue()
Range("M3:IV3").Find(What:="Rad", LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False).Offset(20).value=12
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"CM4@FL" wrote in message
...
I want a macro to find a value in a range and select the cell that matches
the find criteria, after the cell is selected I need it to offset down 20
rows.

Range("M3:IV3").Select
Selection.Find(What:="Rad", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
********Select Found Cell************
********Offset (Down) 20 Rows**************

Thanks in advance


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VBA: Select Cell using find function and offset

It isn't clear whether you want to select all the cells from the found
cell downward for 20 rows, or whether you want to select only the cell
that is 20 rows down. Try

Sub AAA()
Dim RR As Range
Dim FoundCell As Range
Set RR = Range("M3:IV3")
With RR
Set FoundCell = .Find(what:="red", _
after:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
lookat:=xlPart, _
searchdirection:=xlNext, _
MatchCase:=False)
End With
If FoundCell Is Nothing Then
MsgBox "Not Found"
Else
' select cells from FoundCell down for 20 rows
FoundCell.Resize(20, 1).Select
' select only the cell 20 rows down from FoundCell
FoundCell(20, 1).Select
End If
End Sub

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Fri, 24 Apr 2009 15:50:01 -0700, CM4@FL
wrote:

I want a macro to find a value in a range and select the cell that matches
the find criteria, after the cell is selected I need it to offset down 20
rows.

Range("M3:IV3").Select
Selection.Find(What:="Rad", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
********Select Found Cell************
********Offset (Down) 20 Rows**************

Thanks in advance

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
Find String in Cell then Paste Sum in Offset Cell RyanH Excel Programming 1 January 23rd 08 02:06 AM
Find word then use offset to change value in another cell [email protected][_2_] Excel Programming 4 June 7th 07 09:35 PM
Find, Copy offset to offset on other sheet, Run-time 1004. Finny[_3_] Excel Programming 10 December 7th 06 11:46 PM
How to Select a relative range with Using "Find" and Offset() Dennis Excel Discussion (Misc queries) 7 July 27th 05 03:57 PM
vba help pls - find min based on a condition and return val of an offset cell Impakt Excel Programming 2 May 17th 05 12:40 AM


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