473,569 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why is VBA Excel not finding checkbox object?

9 New Member
I have added 4 checkboxes to a spreadsheet and want my macro to check the value of each one. When I step through the macro to the If statement below, I get an error message saying that the object is required. I'm new to VBA and not sure if the problem is there or on the Excel side.

If CheckBox1.Value = False Then

I have tried putting the spreadhsheet name in front of the checkbox name

eg - If MAIN.CheckBox1. Value = False Then

but that didn't help. What am I doing wrong??
May 18 '10 #1
4 21373
QVeen72
1,445 Recognized Expert Top Contributor
Try :
Worksheets("She et1").CheckBox1 .Value
OR
ActiveSheet.Che ckboxes("CheckB ox1").Checked = False
OR
ActiveSheet.Che ckboxes(1).Chec ked = False
May 19 '10 #2
Guido Geurs
767 Recognized Expert Contributor
I'm using excel 2003 and it's working for me with: (see attachment).

Expand|Select|Wrap|Line Numbers
  1. Private Sub CommandButton1_Click()
  2.    If CheckBox1.Value = True Then
  3.       MsgBox ("1")
  4.    ElseIf CheckBox2.Value = True Then
  5.       MsgBox ("2")
  6.    ElseIf CheckBox3.Value = True Then
  7.       MsgBox ("3")
  8.    ElseIf CheckBox4.Value = True Then
  9.       MsgBox ("4")
  10.    Else
  11.       MsgBox ("Select a checkbox !")
  12.    End If
  13. End Sub
  14.  
br,
Attached Files
File Type: zip Why is VBA Excel not finding checkbox object 1.zip (11.6 KB, 497 views)
May 19 '10 #3
rosshughson
9 New Member
Thanks QVeen72. When I included the worksheet name in the format you indicated it worked with no problems.
May 19 '10 #4
rosshughson
9 New Member
@QVeen72
HI. When I specified the worksheet name in the format you specified it worked with no problems. Thanks for your help.
May 19 '10 #5

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

Similar topics

0
1417
by: Curro | last post by:
Hello We've developed a Web Form that uses Excel. We have installed Excel 2000 on Windows 2000. So, we're using Excel 9.0 object library. Now, we want to translate our application to a Windows 2003 Server. ¿Which Excel version should we install? We think that Excel 2000 could be perfect, and no changes to the code will be made.
0
1404
by: Dent | last post by:
I am having a problem with a program that I wrote to format an Excel spreadsheet. I wrote the program on a WinXP/Office XP/Visual Studio .NET 2003 computer. I am using late-binding. When I try to run the program on a Win2000/Office 2000 computer, it errs out during runtime. The error shows that the parameters are incorrect for the Open...
1
1967
by: cybertof | last post by:
Hello, Is there a .net native assembly / object_library to communicate with Excel 2003 ? All articles I have read are all using the Microsoft Excel Object Library which is a COM object, even from .NET ! It sounds to me strange that there would not be any over way to automate Excel 2003 natively, as Excel 2003 already supports 'c# code...
3
7536
by: Ali Tahbaz | last post by:
I'm having trouble iterating through LinkSources in an Excel workbook using C#. I first wrote the below code in VBA to get a quick, correct result, Dim x As Variant For Each x In ThisWorkbook.LinkSources Debug.Print x Next but am so far unable to successfully convert the code to workable
2
15319
by: xhenxhe | last post by:
I don't some Excel automation. I've created a program that opens and Excel template and inputs information to it. It runs great on my machine. When I build and deploy I have a user that keep getting the error message: "Object reference not set to an instance of an object." Here is the code that generates the message: Dim xlApp As...
5
6338
by: brooks | last post by:
I have an unbound OLE object on a form: Name: OLEExcelChart OLE Class: Microsoft Excel 2000 Class: Excel.Chart.8 I need to manipulate properties of the chart as well as the underlying data. I tried changing the chart type with:
1
2226
by: JP | last post by:
I have images within a datalist control. Below is a checkbox control that contains the SQL ID of the image blob. When the page is post back I want to iterate though checkbox collection to get the IDs Normally you can say Request and get all the values for those items that were checked. I want to access the "chkDelete" collection so I can...
1
2022
by: Gultekin Komanli | last post by:
Hi all, When I try to add reference to Excel, I select my project's porperties from the Project menu, on the add reference dialog, tab named COM, there are Excel 11.0 and Excel 5.0 Object Libraries. If I select Excel 11.0 object library, after a few seconds reference shows itself on the references section of my project's properties...
2
1454
by: yogeshtiwarijbp | last post by:
By using add reference i have included microsoft excel 11.0 object library in asp.net and also included in the namespace using microsoft.office.interop.excel and using system .reflection. But the methd or function excel donot display . please help
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.