Macro help to cut and paste rows from one xls file into another

G

Guest

Hi-
I am using FoundCell to find rows in a spreadsheet. Once these rows are
found, I would like to cut and paste them into another spreadsheet that is
stored on a shared drive. Here is what I have so far....any help would be
appreciated.

ells.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range("Q2") _
, Order2:=xlAscending, Key3:=Range("M2"), Order3:=xlAscending,
Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Dim myWord As String
Dim FoundCell As Range
Dim wks As Worksheet

Set wks = ActiveSheet

myWord = "NC"
myWord2 = "ND"
myWord3 = "NI"

With wks.Range("a:a")
Do
Set FoundCell = .Cells.Find(what:=myWord, _
after:=.Cells(.Cells.Count), _
lookat:=xlWhole, MatchCase:=False)
If FoundCell Is Nothing Then
Exit Do
Else

FoundCell.EntireRow.Cut ("intake1.xls")

End If
Loop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top