Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Passing range to a Sub

I've got a worksheet_selection change event and under certain circumstances,
I'd like to call another procedure. I need to pass the TARGET range to that
other procedure. How do I do this? I've tried a couple of things that
don't seem to work.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Passing range to a Sub

Sub Test1()

Dim rng As Range

Set rng = Range(Cells(1), Cells(5, 5))

Test2 rng

End Sub


Sub Test2(rng As Range)

MsgBox rng.Cells.Count

End Sub


RBS


"Barb Reinhardt" wrote in message
...
I've got a worksheet_selection change event and under certain
circumstances,
I'd like to call another procedure. I need to pass the TARGET range to
that
other procedure. How do I do this? I've tried a couple of things that
don't seem to work.

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Passing range to a Sub

And it works just the same in worksheet event:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Test2 Target

End Sub

RBS


"Barb Reinhardt" wrote in message
...
I've got a worksheet_selection change event and under certain
circumstances,
I'd like to call another procedure. I need to pass the TARGET range to
that
other procedure. How do I do this? I've tried a couple of things that
don't seem to work.

Thanks


Reply
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 to a function David Bell Excel Programming 4 July 8th 06 08:32 PM
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 to subprocedure - maybe? Mike Gerbracht Excel Programming 2 July 26th 03 02:44 AM


All times are GMT +1. The time now is 08:44 AM.

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"