Thread: Find and select
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_791_] Leith Ross[_791_] is offline
external usenet poster
 
Posts: 1
Default Find and select


Kash;477897 Wrote:
Hi, I need to find value which is in sheet1.range("B2") in range
sheets("Sep").range("C2:AG2"). Please help


Hello Kash,

Here is sample macro to give you an idea.

================================
Sub FindData()

Dim Data As Variant
Dim FoundIt As Range
Dim Rng As Range

Data = Sheet1.Range("B2")
Set Rng = Sheets("Sep").Range("C2:AG2")

Set FoundIt = Rng.Find(Data, , xlValues, xlWhole, xlByColumns,
xlNext, False)
If FoundIt Is Nothing Then
MsgBox Data & " not found."
Exit Sub
End If

'Insert Code to handle found data here

End Sub
================================


--
Leith Ross

Sincerely,
Leith Ross

'The Code Cage' (http://www.thecodecage.com/)
------------------------------------------------------------------------
Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=131832