Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default how do i create a macro to clear checkboxes and display a message.

Im doing an excel sheet for work and need to program a macro so that say when
two checkboxes are checked at the same time it unchecks them and creates a
message box signifying an error. Maybe even have it play a sound too
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default how do i create a macro to clear checkboxes and display a message.

Why not just use Option Buttons instead of Check Boxes. They only allow one
to be checked at a time?

HTH

"Xavierskyrider" wrote:

Im doing an excel sheet for work and need to program a macro so that say when
two checkboxes are checked at the same time it unchecks them and creates a
message box signifying an error. Maybe even have it play a sound too

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default how do i create a macro to clear checkboxes and display a mess

Well the problem is I want the checkboxes to either have one checked or none
because im doing a business model for capital equipment so that it can only
have one add-on and not the other or none of them. Having three option
buttons would look odd on the sheet.

"Jim Thomlinson" wrote:

Why not just use Option Buttons instead of Check Boxes. They only allow one
to be checked at a time?

HTH

"Xavierskyrider" wrote:

Im doing an excel sheet for work and need to program a macro so that say when
two checkboxes are checked at the same time it unchecks them and creates a
message box signifying an error. Maybe even have it play a sound too

  #4   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default how do i create a macro to clear checkboxes and display a mess

I have about Ten "sets" of checkboxes that have the same problem
In order for this to work i simply used the click event of the checkboxes
(if they are form controls) to check the other check box eg you have two
check boxes, one is named WHITE the other is named BLACk

this is in the sheet module

private sub WHITE_click ()
if WHITE.value = true and BLACK.value = TRUE then
WHITE.value = false
BLACK.value = false
Beep
msgbox "You can not do that.
end if
end sub




"Xavierskyrider" wrote:

Well the problem is I want the checkboxes to either have one checked or none
because im doing a business model for capital equipment so that it can only
have one add-on and not the other or none of them. Having three option
buttons would look odd on the sheet.

"Jim Thomlinson" wrote:

Why not just use Option Buttons instead of Check Boxes. They only allow one
to be checked at a time?

HTH

"Xavierskyrider" wrote:

Im doing an excel sheet for work and need to program a macro so that say when
two checkboxes are checked at the same time it unchecks them and creates a
message box signifying an error. Maybe even have it play a sound too

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default how do i create a macro to clear checkboxes and display a mess

What if I want to have a custom sound instead of the beep?

"ben" wrote:

I have about Ten "sets" of checkboxes that have the same problem
In order for this to work i simply used the click event of the checkboxes
(if they are form controls) to check the other check box eg you have two
check boxes, one is named WHITE the other is named BLACk

this is in the sheet module

private sub WHITE_click ()
if WHITE.value = true and BLACK.value = TRUE then
WHITE.value = false
BLACK.value = false
Beep
msgbox "You can not do that.
end if
end sub




"Xavierskyrider" wrote:

Well the problem is I want the checkboxes to either have one checked or none
because im doing a business model for capital equipment so that it can only
have one add-on and not the other or none of them. Having three option
buttons would look odd on the sheet.

"Jim Thomlinson" wrote:

Why not just use Option Buttons instead of Check Boxes. They only allow one
to be checked at a time?

HTH

"Xavierskyrider" wrote:

Im doing an excel sheet for work and need to program a macro so that say when
two checkboxes are checked at the same time it unchecks them and creates a
message box signifying an error. Maybe even have it play a sound too



  #6   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default how do i create a macro to clear checkboxes and display a mess

you can play wave files, i'm not sure of the exact syntax but saerch vba help
for "wave" or playsound
ben

"Xavierskyrider" wrote:

What if I want to have a custom sound instead of the beep?

"ben" wrote:

I have about Ten "sets" of checkboxes that have the same problem
In order for this to work i simply used the click event of the checkboxes
(if they are form controls) to check the other check box eg you have two
check boxes, one is named WHITE the other is named BLACk

this is in the sheet module

private sub WHITE_click ()
if WHITE.value = true and BLACK.value = TRUE then
WHITE.value = false
BLACK.value = false
Beep
msgbox "You can not do that.
end if
end sub




"Xavierskyrider" wrote:

Well the problem is I want the checkboxes to either have one checked or none
because im doing a business model for capital equipment so that it can only
have one add-on and not the other or none of them. Having three option
buttons would look odd on the sheet.

"Jim Thomlinson" wrote:

Why not just use Option Buttons instead of Check Boxes. They only allow one
to be checked at a time?

HTH

"Xavierskyrider" wrote:

Im doing an excel sheet for work and need to program a macro so that say when
two checkboxes are checked at the same time it unchecks them and creates a
message box signifying an error. Maybe even have it play a sound too

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default how do i create a macro to clear checkboxes and display a mess

I named the check boxes as you said and im getting an end sub error when I
try clicking one of the boxes. Was i not supposed to assign the macro to one
of the check boxes? Where do i assign the macro to?

"ben" wrote:

I have about Ten "sets" of checkboxes that have the same problem
In order for this to work i simply used the click event of the checkboxes
(if they are form controls) to check the other check box eg you have two
check boxes, one is named WHITE the other is named BLACk

this is in the sheet module

private sub WHITE_click ()
if WHITE.value = true and BLACK.value = TRUE then
WHITE.value = false
BLACK.value = false
Beep
msgbox "You can not do that.
end if
end sub




"Xavierskyrider" wrote:

Well the problem is I want the checkboxes to either have one checked or none
because im doing a business model for capital equipment so that it can only
have one add-on and not the other or none of them. Having three option
buttons would look odd on the sheet.

"Jim Thomlinson" wrote:

Why not just use Option Buttons instead of Check Boxes. They only allow one
to be checked at a time?

HTH

"Xavierskyrider" wrote:

Im doing an excel sheet for work and need to program a macro so that say when
two checkboxes are checked at the same time it unchecks them and creates a
message box signifying an error. Maybe even have it play a sound too

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default how do i create a macro to clear checkboxes and display a message.


Ben I'm getting an end sub error so when I tried taking out the private part
it highlights the If WHITE.Value = True And BLACK.Value = True Then and gives
me an error for some reason its not working
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
Clear certain checkboxes Arlen Excel Discussion (Misc queries) 4 May 20th 10 11:42 PM
Macro to clear checkboxes Guy[_2_] Excel Worksheet Functions 5 January 2nd 09 08:39 PM
Macro to clear checkboxes and protected cells Guy[_2_] Excel Worksheet Functions 2 December 29th 08 08:54 PM
Macro to make all checkboxes false and clear all comboxes ynissel Excel Discussion (Misc queries) 5 July 30th 05 12:22 AM
Clear All Checkboxes? Brad Excel Programming 3 January 11th 05 07:58 PM


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