copy/paste VBA

  • Thread starter Thread starter matt
  • Start date Start date
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
 
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
 
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
 
Back
Top