View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
ForSale[_73_] ForSale[_73_] is offline
external usenet poster
 
Posts: 1
Default Lookup or Index or Match, not sure.


Sub FindMatch(Target As Range)
Const StartCell As String = "B6"
Dim SearchVal
Dim cell As Range
Dim i As Long
Dim FirstAddress As String

If Not Target.Address = "$B$1" Then Exit Sub
Application.ScreenUpdating = False
SearchVal = Range("B1").Text
With Worksheets("Data Entry").Range("A:A")
Set cell = .Find(SearchVal, LookIn:=xlValues)
If Not cell Is Nothing Then
FirstAddress = cell.Address
Do
cell.Resize(1, 10).Copy Range(StartCell).Offset(i, 0)
i = i + 1
Set cell = .FindNext(cell)
Loop While Not cell Is Nothing And cell.Address < FirstAddress
End If
End With

Application.ScreenUpdating = True
End Sub





Bob Phillips Wrote:
If you post the code that you have now that moves all the correct data
I
will add the clear.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"ForSale" wrot
in
message ...

Bob,
With your code I have figured out how to move all of the cells tha

I
need. I am still having trouble clearing sheet2 before running
FindMatch. I have named the range that needs to be cleared 'field'.

Any ideas?

Thanks.


--
ForSale


------------------------------------------------------------------------
ForSale's Profile:

http://www.excelforum.com/member.php...o&userid=11896
View this thread

http://www.excelforum.com/showthread...hreadid=549232


--
ForSal
-----------------------------------------------------------------------
ForSale's Profile: http://www.excelforum.com/member.php...fo&userid=1189
View this thread: http://www.excelforum.com/showthread.php?threadid=54923