LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing a Range Jerry Excel Programming 4 February 14th 05 10:52 AM
Passing a range into a VBA function Floyd[_2_] Excel Programming 4 February 10th 05 01:29 AM
passing range to c# Jerry Excel Programming 0 January 29th 05 08:29 PM
Passing range as argument Jan Kronsell[_2_] Excel Programming 3 September 3rd 03 12:31 PM
Passing range to subprocedure - maybe? Mike Gerbracht Excel Programming 2 July 26th 03 02:44 AM


All times are GMT +1. The time now is 05:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"