Thread: Find Function
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Find Function

Hi,
Based on the routine you referenced, try this:

Sub test()
Dim rng As Range
Set rng = Find_Range("Sales", Range("a1:a50"))
rng.Copy Worksheets("sheet2").Range("a1") 'Copy date
rng.EntireRow.Delete ' Delete original rows
End Sub


HTH

"DejaVu" wrote:


I modified some code from Aaron Blood and Ivan F Moala at:
http://www.ozgrid.com/forum/showthre...t=27240&page=1

This is a find function that I am using to find all rows that contain
"Sales" in column J, and move them from Sheet1 to Sheet2. This
function works perfectly, but I'm wanting it do do a little more. If I
can figure it out, I'd like it to delete the rows from Sheet1 that it
pastes into Sheet2. I can write a little procedure after this function
to do this, but I was wondering if it is possible to do inside the
function.

This is what I'm using right now outside of the function, and it works
fine:
For Each tmpRng In rngSls
If ActiveCell.Value = "Sales" Then
ActiveCell.EntireRow.Delete
End If
ActiveCell.Offset(1, 0).Select
Next

Any better solutions or ideas are greatly appreciated.

DejaVu


--
DejaVu
------------------------------------------------------------------------
DejaVu's Profile: http://www.excelforum.com/member.php...o&userid=22629
View this thread: http://www.excelforum.com/showthread...hreadid=385313