Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mac Mac is offline
external usenet poster
 
Posts: 213
Default From SelectionChange into UserForm

I've defined a UserForm in my worksheet and I also intercept the
Worksheet_SelectionChange; my question is - how do I get the Range variable
obtained via the Worksheet_SelectionChange method into the UserForm for
display? Tried adding a method to the form code and calling it with the Range
parameter from within Worksheet_SelectionChange, but this doesn't seem to
work ...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default From SelectionChange into UserForm

One way...

In a VBA module (Insert Module in the Visual Basic Editor), define a
global Range variable:

Global CurrRng as Range

In the Worksheet_SelectionChange event code, assign the Target range value
to CurrRng:

Set CurrRng = Target

Your userform code can use CurrRng like any other variable. Before you close
the workbook, you should free the memory used by CurrRng:

Set CurrRng = Nothing

Hope this helps,

Hutch

"Mac" wrote:

I've defined a UserForm in my worksheet and I also intercept the
Worksheet_SelectionChange; my question is - how do I get the Range variable
obtained via the Worksheet_SelectionChange method into the UserForm for
display? Tried adding a method to the form code and calling it with the Range
parameter from within Worksheet_SelectionChange, but this doesn't seem to
work ...

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
SelectionChange Alex McDermott Excel Programming 1 May 3rd 07 03:54 PM
beforedoubleclick and selectionchange clara Excel Programming 0 April 24th 07 06:52 PM
SelectionChange userform Nicodemus Excel Programming 5 July 22nd 06 09:52 PM
SelectionChange event Kate Excel Programming 2 December 22nd 05 06:03 PM
SelectionChange event Hayeso Excel Programming 2 July 1st 05 03:07 PM


All times are GMT +1. The time now is 08:34 PM.

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

About Us

"It's about Microsoft Excel"