View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Andrew Smith Andrew Smith is offline
external usenet poster
 
Posts: 6
Default FindNext and Copy Help (Urgent)

This code is a little more complicated but works for me, only problem
is it generates an error if there are no values found. I create loop
that terminates when you get back to the original value. Please let
me know if this works for you or if you find a simpler way of
implementing:


'Find first instance and record location
Cells.Find(What:="31", after:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Activate
firstrow = ActiveCell.Row
firstcol = ActiveCell.Column
foundlast = 0



Do While foundlast = 0 'loop till at first location again

Cells.Find(What:="31", after:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Activate
th_row = ActiveCell.Row
th_col = ActiveCell.Column





If th_row = firstrow Then
If th_col = firstcol Then foundlast = 1

End If]




[INSERT YOUR COMMANDS HERE]



Loop