2 ranges into one
Sub CopyToday()
Dim Rng As Range
Dim sh as Worksheet
set sh = Worksheets("Sheet1")
With sh
Set Rng = .Rows(2).Find(Date).Offset(1, 0)
.Range(Rng, Rng.Offset(Range("Attendance").Rows.Count - 1, 0)).Copy _
Destination:=Sheets(3).Range(Rng.Address)
End With
set sh = Worksheets("Sheet2")
With sh
Set Rng = .Rows(2).Find(Date).Offset(1, 0)
.Range(Rng, Rng.Offset(Range("Attendance").Rows.Count - 1, 0)).Copy _
Destination:=Sheets(3).Range(Rng.Address)(1).end(x ldown)(2)
End With
End Sub
You leave out many important details such as where to place the second set
of data, what the sheet names are and so forth. For the second range, I
have left in the Range("Attendance") part, but clearly that would not
correspond to the second set of data, so you would need to change how the
extent of the second range is determined. But basically the approach is to
do two copy operations, with the second placed below the first.
--
Regards,
Tom Ogilvy
"David" wrote in message
...
XL2000
I've been happily using the following to copy a range of non-contiguous
checkmarks under current date on one sheet to a range on another sheet
under current date:
Sub CopyToday()
Dim Rng As Range
Set Rng = Rows(2).Find(Date).Offset(1, 0)
Range(Rng, Rng.Offset(Range("Attendance").Rows.Count - 1, 0)).Copy _
Destination:=Sheets(3).Range(Rng.Address)
End Sub
Now "the boss" needs another identical source sheet that will have a
different set of checkmarks under current date, so now there will be 2
sets
of checkmarks to copy into this destination. I looked at Union(), but from
what I've read, it doesn't work with ranges from different sheets.
Playing out options in my mind, I thought maybe copying both sets to
columns in a temporary location then use Union() in a third column in that
temporary location to "merge" the checkmarks, then copy that range to the
destination, then delete the temporary location, but that seems like a lot
to do to accomplish what should be easier. Besides, I can't come up with
the code to do that anyway.
Can anyone help me get all checkmarks from 2 sheets into my Destination?
--
David
|