473,322 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

check box in excel

142 100+
In a excel checkbox, it run when I put or remove the check mark in the checkbox. What is the function to make it run only when i put the check mark to the checkbox but not when i remove the check mark.
thanks
Mar 27 '07 #1
2 6286
SammyB
807 Expert 512MB
In a excel checkbox, it run when I put or remove the check mark in the checkbox. What is the function to make it run only when i put the check mark to the checkbox but not when i remove the check mark.
thanks
  1. Menu: View, Toolbars, put a checkmark before Visual Basic
  2. In the VB Toolbar, press the Control Toolbox window.
  3. In the Control Toolbox, select the checkbox and click on the worksheet to get CheckBox1
  4. Click the Properties button in the Control Toolbox
  5. Change any of the properties to what you want them to be
  6. Right-click on the check-box on the worksheet and choose View Code
  7. Finish the Event code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub CheckBox1_Click()
  2.     If CheckBox1 Then MsgBox "DoIt"
  3. End Sub
Now, go back to Excel and exit the design mode with the Control Toolbox. Test and see. You should get a message only when checking.

Note -- in a regular macro module, you will need to qualify CheckBox1 with the sheet name:
Expand|Select|Wrap|Line Numbers
  1. Sub Macro1()
  2. '
  3. ' Macro1 Macro
  4.     If Worksheets("Sheet1").CheckBox1 Then MsgBox "Checked"
  5. End Sub
Final note -- in the properties, before you write the code, you should change the name from CheckBox1 to something meaningful, like ChkVisio. Then in the rest of my instructions, change CheckBox1 to ChkVisio.
Mar 28 '07 #2
Try
if checkbox1=true then
msgbox "good"
Else
Mar 29 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: deko | last post by:
Is there a way to check user input for illegal characters? For example, a user enters something into a text box and clicks OK. At that point I'd like to run code such as this: illegal =...
32
by: deko | last post by:
I'm trying to create an MSI in VS.NET that will check for installed Office System components - so my MDE will only install if requirements are met. I'm thinking about using VBScript to inspect...
2
by: Maik | last post by:
Hi everybody, I want to automate an Excel97 application using C#. I use the excel8.olb file as COM interface. How can I check the country code of the installed Excel application? I know that there...
3
by: Asha | last post by:
hello... i'm uploading data from an excel file to the server, and to check the data values; i loop though excel file row by row and compare the value with database value. if anything does not...
4
by: JIM.H. | last post by:
Hello, I am using this code to display excel in IE. locFilesPath = "D:\Files\myFile.xls" If (System.IO.File.Exists(locFilesPath)) Then Response.Clear() Response.ContentType =...
1
by: Glen Vermeylen | last post by:
Hi, For a project at school we have to automate the assignment of seats in classrooms to students during the exams. The lady who previously did everything manually kept the layouts of the...
7
by: Alain \Mbuna\ | last post by:
Hi everybody. Does anyone know what code I should use to check for the version number of Excel, installed on a computer? Thanks. Alain.
3
by: Bullfrog | last post by:
I have a database that one of the fields is a check box. Basically a check means yes, no check means no. I am trying to import data from an Excel spreadsheet. I assumed the check box would use a...
1
by: santel | last post by:
Hi, How to check whether the MSOffice files like word, excel, powerpoint are installed in the machine or not? Anyone please help!
1
by: steevan16 | last post by:
Hi, Not sure if I am in the right section. Just have a query about manipulating excel spreadsheet using vbscript. I am developing a vbscript which runs on client xp machines to retrieve certain...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.