copy/paste VBA

M

matt

I am trying to write code that will search a sheet and
select all of the rows that contain a certain date. Then
I want to copy/paste all of the rows onto a different
sheet.
I am having some trouble with this, please help!
Matt
 
D

Don Guillett

try something like where b2 has the date desired

for each c in selection
if c=range("b2") then c.copy
sheets("sheet2").range("a"&range("a65536").end(xlup).row)
next c
 
K

kiat

Dim xC As Range, xDate As Date, xRows As String
xDate = "22 August 2003"
For Each xC In ActiveSheet.Range("date")
If xC.Value = xDate Then xRows = xRows & "," & xC.Row & ":" & xC.Row
Next
If Len(xRows) Then
xRows = Mid$(xRows, 2)
ActiveSheet.Range(xRows).Copy
Destination:=Worksheets("Sheet2").Range("A1")
End If
 

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