Help with Macor

G

gsxith3

I would like to add a button to a worksheet that would allow input of an
value to be search fro in column C. If the value is found the entire
contents of the row would then be added to a new worksheet. I was trying to
write a macro to do this- but alas it appears to be beyond me, Any help
would be greatly appreciated!
 
D

Don Guillett

Recorded and cleaned up macro to find smith and copy row to another sheet

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 8/2/2008 by Donald B. Guillett
'

'
Columns("J:J").Select
Selection.Find(What:="smith", After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Rows("5:5").Select
Selection.Copy
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Sheet2"
Rows("8:8").Select
ActiveSheet.Paste
End Sub

Sub findandcopyrow()
Columns("J").Find(What:="smith", After:=Cells(1, "J"), LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).EntireRow.Copy _
Sheets("Sheet2").Rows("8:8")
End Sub
 

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