Finding, copying and pasting
Put the 15 entries from column A in a new worksheet. then write a macro tha
wil only move these rows. I didn't test the code below but will do the job
after it is debugged. It may even work first time. I wrote a lot of code
just like this in the past.
Sub move_data()
Workbooks.Add
Set newbk = ActiveWorkbook
NewbkRowcount = 1
With ThisWorkbook.Sheets("sheet2")
Sh2Rowcount = 1
Do While .Range("A" & Sh2Rowcount) < ""
SearchName = .Range("A" & Sh2Rowcount)
With ThisWorkbook.Sheets("sheet1")
Sh1RowCount = 1
Do While .Range("A" & Sh1RowCount) < ""
If SearchName = .Range("A" & Sh1RowCount) Then
.Rows(Sh1RowCount).Copy _
Destination:=newbk.Sheets("sheet1").Rows(NewbkRowc ount)
NewbkRowcount = NewbkRowcount + 1
End If
Sh1RowCount = Sh1RowCount + 1
Loop
End With
Sh2Rowcount = Sh2Rowcount + 1
Loop
End With
End Sub
" wrote:
I want to get some code that will do a few functions for me. I have a
worksheet with 1000's of entries and I want to find and use only about
15 of them. I can find them by their name which is displayed in column
A, I then want to select the whole row and add it to a new worksheet.
I want to repeat this for the other 14 entries and add them to the
same new worksheet.
Any helpful thoughts?
|