ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy/paste VBA (https://www.excelbanter.com/excel-programming/275049-copy-paste-vba.html)

matt

copy/paste VBA
 
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

Don Guillett[_4_]

copy/paste VBA
 
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(xlu p).row)
next c

"matt" wrote in message
...
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




kiat

copy/paste VBA
 
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


"matt" wrote in message
...
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





All times are GMT +1. The time now is 10:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com