passing a range from another worksheet
Hi all,
Apologies for this - this is probably quite a basic question, but I'm afraid
I can't seem to find the answer, and all the bookshops I'd go to for
something to help me out are closed at this time of night. In my defence, I
started working with VBA about four hours ago.
I've got a subroutine (lifted from another thread in this group) which is
adding two ranges. This is great when the ranges are on the same sheet, but
VBA doesn't seem to like attemts to pass ranges from other pages. So when I
try
AddRanges Range("F6:J10"), Range (Sheet2.Range("C4:G8"))
calling a subroutine
Private Sub AddRanges(RangeOne As Range, RangeTwo As Range)
I get a run-time error 1004 - Method "Range" of object '_Worksheet' failed.
I've tried playing with the quotes and brackets, but haven't had any success.
The Sheet2 reference works fine for a straightforward copy, so is it
something about passing this sort of range as a parameter?
Thanks for any help,
Mike
|