Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Help! Can't refer to a subroutine on a worksheet

I am writing a subroutine attached to a command button on a sheet that
looks through all the other sheets in the worksheets() collection and,
if applicable, runs the commandbutton1_click subroutine on each sheet.
Unfortunately different sheets have different commandbutton1 code but
the subroutine I'm writing needs to 'click' them all. I've made
commandbutton1_click public on each sheet.

No luck with worksheets(n).commandbutton1_click. Any suggestions how to
do this?

Thanks everyone!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Help! Can't refer to a subroutine on a worksheet

Go by the codename

application.run worksheets(n).codename & ".commandbutton1_click"

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Duncan" wrote in message
ups.com...
I am writing a subroutine attached to a command button on a sheet that
looks through all the other sheets in the worksheets() collection and,
if applicable, runs the commandbutton1_click subroutine on each sheet.
Unfortunately different sheets have different commandbutton1 code but
the subroutine I'm writing needs to 'click' them all. I've made
commandbutton1_click public on each sheet.

No luck with worksheets(n).commandbutton1_click. Any suggestions how to
do this?

Thanks everyone!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Help! Can't refer to a subroutine on a worksheet

Works great!


Bob Phillips wrote:
Go by the codename

application.run worksheets(n).codename & ".commandbutton1_click"

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Duncan" wrote in message
ups.com...
I am writing a subroutine attached to a command button on a sheet that
looks through all the other sheets in the worksheets() collection and,
if applicable, runs the commandbutton1_click subroutine on each sheet.
Unfortunately different sheets have different commandbutton1 code but
the subroutine I'm writing needs to 'click' them all. I've made
commandbutton1_click public on each sheet.

No luck with worksheets(n).commandbutton1_click. Any suggestions how to
do this?

Thanks everyone!


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
Call a subroutine using variable subroutine name dhstein Excel Discussion (Misc queries) 3 July 26th 09 08:28 PM
Refer to worksheet Arne Hegefors Excel Programming 2 August 25th 06 01:39 PM
worksheet subroutine causes Compile error: Not found when on User Jim Brownson Excel Programming 3 August 9th 06 07:15 PM
Worksheet Cell Range Name within VB Subroutine Jay Somerset Excel Discussion (Misc queries) 5 February 6th 06 02:27 PM
How do I run a subroutine on a worksheet Myron Excel Programming 3 September 8th 03 09:54 PM


All times are GMT +1. The time now is 04:09 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"