Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Universal procedure for changes

Howdy
I've got a variety of Control forms in my worksheet.
In the change event of a number of these form elements, I need to copy the
new value to another worksheet.
Can I write one procedure for this and inside this proc use something like
"me.value" to referring to the calling elements value? or do I have to write
out code for each and every form elements who's change I want to capture?
Thanks
Matt


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Universal procedure for changes

Matt,

You can't use me as that will refer to a level above the control, such as
the form, or the worksheet.

What you can try is to create a class to handle multiple controls. John
Walkenbach has a demo on his site at
http://j-walk.com/ss/excel/tips/tip44.htm. This demo is for commandbuttons,
but play with and try other controls.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matt Jensen" wrote in message
...
Howdy
I've got a variety of Control forms in my worksheet.
In the change event of a number of these form elements, I need to copy the
new value to another worksheet.
Can I write one procedure for this and inside this proc use something like
"me.value" to referring to the calling elements value? or do I have to

write
out code for each and every form elements who's change I want to capture?
Thanks
Matt




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Universal procedure for changes

Cool thanks Bob!
So am I right in saying that what you and John are saying is that a
procedure can't know the name of 'element' that called it without using a
class?
I don't understand why you can't use that ShowDialog() code as a normal Sub
without the class? There is some fundamental principle I'm missing it
seems... Does the example only apply to a userform? My labels are embedded
in my worksheet if that makes a difference...
Cheers
Matt


"Bob Phillips" wrote in message
...
Matt,

You can't use me as that will refer to a level above the control, such as
the form, or the worksheet.

What you can try is to create a class to handle multiple controls. John
Walkenbach has a demo on his site at
http://j-walk.com/ss/excel/tips/tip44.htm. This demo is for

commandbuttons,
but play with and try other controls.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matt Jensen" wrote in message
...
Howdy
I've got a variety of Control forms in my worksheet.
In the change event of a number of these form elements, I need to copy

the
new value to another worksheet.
Can I write one procedure for this and inside this proc use something

like
"me.value" to referring to the calling elements value? or do I have to

write
out code for each and every form elements who's change I want to

capture?
Thanks
Matt






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Universal procedure for changes

You may want to consider using the controls from the Forms toolbar. You may be
able to assign each the same macro and deterime what should happen to what in
code.



Matt Jensen wrote:

Howdy
I've got a variety of Control forms in my worksheet.
In the change event of a number of these form elements, I need to copy the
new value to another worksheet.
Can I write one procedure for this and inside this proc use something like
"me.value" to referring to the calling elements value? or do I have to write
out code for each and every form elements who's change I want to capture?
Thanks
Matt


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Universal procedure for changes

Matt,

When you mentioned control forms, I thought you meant userforms. This
technique is for userforms.

If you have buttons from the forms toolbar on the worksheet, you can assign
them all to the same macro, and test Application.Caller to find out which
button called the macro.

If it is control toolbox buttons, you have a bigger job.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matt Jensen" wrote in message
...
Cool thanks Bob!
So am I right in saying that what you and John are saying is that a
procedure can't know the name of 'element' that called it without using a
class?
I don't understand why you can't use that ShowDialog() code as a normal

Sub
without the class? There is some fundamental principle I'm missing it
seems... Does the example only apply to a userform? My labels are embedded
in my worksheet if that makes a difference...
Cheers
Matt


"Bob Phillips" wrote in message
...
Matt,

You can't use me as that will refer to a level above the control, such

as
the form, or the worksheet.

What you can try is to create a class to handle multiple controls. John
Walkenbach has a demo on his site at
http://j-walk.com/ss/excel/tips/tip44.htm. This demo is for

commandbuttons,
but play with and try other controls.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matt Jensen" wrote in message
...
Howdy
I've got a variety of Control forms in my worksheet.
In the change event of a number of these form elements, I need to copy

the
new value to another worksheet.
Can I write one procedure for this and inside this proc use something

like
"me.value" to referring to the calling elements value? or do I have to

write
out code for each and every form elements who's change I want to

capture?
Thanks
Matt










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Universal procedure for changes

Yeah they are control toolbox buttons, that was decided a while back as they
needs to be that way. I did see a similar example by Tom Olgilvy when doing
a google groups search of this which should suffice for solving it, however
I still don't understand the fundamental problems I detailed in my second
post...
Matt

"Bob Phillips" wrote in message
...
Matt,

When you mentioned control forms, I thought you meant userforms. This
technique is for userforms.

If you have buttons from the forms toolbar on the worksheet, you can

assign
them all to the same macro, and test Application.Caller to find out which
button called the macro.

If it is control toolbox buttons, you have a bigger job.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matt Jensen" wrote in message
...
Cool thanks Bob!
So am I right in saying that what you and John are saying is that a
procedure can't know the name of 'element' that called it without using

a
class?
I don't understand why you can't use that ShowDialog() code as a normal

Sub
without the class? There is some fundamental principle I'm missing it
seems... Does the example only apply to a userform? My labels are

embedded
in my worksheet if that makes a difference...
Cheers
Matt


"Bob Phillips" wrote in message
...
Matt,

You can't use me as that will refer to a level above the control, such

as
the form, or the worksheet.

What you can try is to create a class to handle multiple controls.

John
Walkenbach has a demo on his site at
http://j-walk.com/ss/excel/tips/tip44.htm. This demo is for

commandbuttons,
but play with and try other controls.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matt Jensen" wrote in message
...
Howdy
I've got a variety of Control forms in my worksheet.
In the change event of a number of these form elements, I need to

copy
the
new value to another worksheet.
Can I write one procedure for this and inside this proc use

something
like
"me.value" to referring to the calling elements value? or do I have

to
write
out code for each and every form elements who's change I want to

capture?
Thanks
Matt










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
How to turn on universal scrolling? C Fowler Excel Discussion (Misc queries) 1 January 21st 09 04:01 PM
Universal formulas for any given row lamontd7 New Users to Excel 3 August 1st 05 02:55 PM
Use combobox for universal purpose Pat Excel Programming 20 May 8th 04 09:01 PM
Universal Macro Sam Thurston Excel Programming 2 February 21st 04 12:28 AM


All times are GMT +1. The time now is 02:31 AM.

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"