View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
kathryn462 kathryn462 is offline
external usenet poster
 
Posts: 2
Default macro to copy and paste based on a condition

That is not exactly what I am looking for. Basically I have a list of
employees with information about them and a drop down list to retain or
terminate. I need to automatically copy all of the information onto a
separate sheet for anyone who is selected as a term.

"Sheeloo" wrote:

Try this
[Posted elsewhere by someone (sorry for not being able to attribute to the
original contributor)]

'This will prompt for the value you want to check for and copy the first
row, from sheet1, where Col A contains that value to Sheet2 below the data
already there..

Sub CopyRow()
Dim Answer As String
Dim LastRowOnSheet2 As Long
With Worksheets("Sheet2")
LastRowOnSheet2 = .Cells(.Rows.Count, "A").End(xlUp).Row

If LastRowOnSheet2 = 1 And .Cells(1, "A").Value = "" Then
LastRowOnSheet2 = 0
End If

Answer = InputBox("Find what in Col A in Sheet1 and copy it to Sheet2?")
Worksheets("Sheet1").Columns("A").Find(Answer).Ent ireRow. _
Copy .Range("A" & (LastRowOnSheet2 + 1))
End With
End Sub--
If you find this post helpful pl. choose "Yes"...


"kathryn462" wrote:

I need a way to copy a row of information and then paste it into a new
worksheet based on a cell containing the text "TERM". Is that possible?

thanks!