ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Coupled controls? (https://www.excelbanter.com/new-users-excel/93315-coupled-controls.html)

Ruatha

Coupled controls?
 

Hi, I have a button assciated with a macro, but I want to make sure that
the button isn't pressed by mistake.
So I was thinking of having a checkbox, that when checked enables the
command button, and when unchecked the button is disabled.
How do I do that?


--
Ruatha
------------------------------------------------------------------------
Ruatha's Profile: http://www.excelforum.com/member.php...o&userid=31083
View this thread: http://www.excelforum.com/showthread...hreadid=550770


Dave Peterson

Coupled controls?
 
I think I'd just add a bit to the macro that is associated with the button.

Option explicit
sub yoursubhere()

dim resp as long

resp = msgbox(Prompt:="Are you sure you want to do all this stuff", _
buttons:=vbyesno)

if resp = vbno then
exit sub
end if

'rest of your code here

Ruatha wrote:

Hi, I have a button assciated with a macro, but I want to make sure that
the button isn't pressed by mistake.
So I was thinking of having a checkbox, that when checked enables the
command button, and when unchecked the button is disabled.
How do I do that?

--
Ruatha
------------------------------------------------------------------------
Ruatha's Profile: http://www.excelforum.com/member.php...o&userid=31083
View this thread: http://www.excelforum.com/showthread...hreadid=550770


--

Dave Peterson

Ruatha

Coupled controls?
 

Thanx for the help, I'll do that!


--
Ruatha
------------------------------------------------------------------------
Ruatha's Profile: http://www.excelforum.com/member.php...o&userid=31083
View this thread: http://www.excelforum.com/showthread...hreadid=550770



All times are GMT +1. The time now is 09:22 AM.

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