ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help! Can't refer to a subroutine on a worksheet (https://www.excelbanter.com/excel-programming/377104-help-cant-refer-subroutine-worksheet.html)

Duncan[_7_]

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!


Bob Phillips

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!




Duncan[_7_]

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!




All times are GMT +1. The time now is 04:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com