View Single Post
  #4   Report Post  
WillR
 
Posts: n/a
Default

Something like this would do it...

Sub findit()
Dim rngFound As Range
Dim rngFind As Range
Dim rngStart As Range
Dim strFind As String

strFind = Range("K12").Value
'set the range to search
Set rngFind = Range("A2:A50")
'set where to start the search
Set rngStart = rngFind.Cells(1)
'try & find it
Set rngFound = rngFind.Find(What:=strFind, After:=rngStart,
LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False)
'found it
If Not rngFound Is Nothing Then
MsgBox "Value Found at: " & rngFound.Address
rngFound.Activate
Else
'didn't find it
MsgBox "Sorry, couldn't find " & strFind & " in that range."
End If
'clean up
Set rngFind = Nothing
Set rngStart = Nothing
Set rngFound = Nothing
strFind = vbNullString
End Sub

--
Kind Regards,
Will Riley


"Nigel" wrote:

Hi,
i am really struggling to create a macro to carry out the following.
( i am quite new to this and presently using a book but things are explained
fully!)

lets say cell K12 = 2245
i have a range of A2:A50 containing a list between 2220 & 2270

i need my macro to look at the value of K12. Find that value in range, and
make the cell with that value active
so in my list between 2220 & 2270 is an activecell where the value is 2245

i hope this can be done and hope that someone can help me.

Regards,

Nigel