Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ram Ram is offline
external usenet poster
 
Posts: 138
Default Code to loop through multiple checkboxes

I have 30 check boxes on a spreadsheet I want to copy the values over to a
table to keep the history of the check box values each time the survey is
completed.

How can I Create a loop that retrives the value from each check box then
copies the value to the first blank row in my table. then changes the values
to all the checkboxes to false.

Thanks for any help




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Code to loop through multiple checkboxes

Forms or controltoolbox checkboxes ?

Are the names something like CheckBox1....CheckBox30

--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
I have 30 check boxes on a spreadsheet I want to copy the values over to a
table to keep the history of the check box values each time the survey is
completed.

How can I Create a loop that retrives the value from each check box then
copies the value to the first blank row in my table. then changes the values
to all the checkboxes to false.

Thanks for any help






  #3   Report Post  
Posted to microsoft.public.excel.programming
Ram Ram is offline
external usenet poster
 
Posts: 138
Default Code to loop through multiple checkboxes

ROn they are controltoolbox checkboxes, CheckBox1....CheckBox30

"Ron de Bruin" wrote:

Forms or controltoolbox checkboxes ?

Are the names something like CheckBox1....CheckBox30

--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
I have 30 check boxes on a spreadsheet I want to copy the values over to a
table to keep the history of the check box values each time the survey is
completed.

How can I Create a loop that retrives the value from each check box then
copies the value to the first blank row in my table. then changes the values
to all the checkboxes to false.

Thanks for any help







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Code to loop through multiple checkboxes

Hi Ram

I think I will use a linkedcell (see properties of each checkbox)
Use cells in a row below your data.
You can hide that row

Then you can use code from this page to copy for example A50:AD50 to the database sheet
http://www.rondebruin.nl/copy1.htm

This two examples change the values to false

Sub Test1()
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Then
obj.Object.Value = False
End If
Next
End Sub

Or this one

Sub Test2()
For i = 1 To 30
ActiveSheet.OLEObjects("CheckBox" & i). _
Object.Value = False
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
ROn they are controltoolbox checkboxes, CheckBox1....CheckBox30

"Ron de Bruin" wrote:

Forms or controltoolbox checkboxes ?

Are the names something like CheckBox1....CheckBox30

--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
I have 30 check boxes on a spreadsheet I want to copy the values over to a
table to keep the history of the check box values each time the survey is
completed.

How can I Create a loop that retrives the value from each check box then
copies the value to the first blank row in my table. then changes the values
to all the checkboxes to false.

Thanks for any help









  #5   Report Post  
Posted to microsoft.public.excel.programming
Ram Ram is offline
external usenet poster
 
Posts: 138
Default Code to loop through multiple checkboxes

Thanks for your help Ron


"Ron de Bruin" wrote:

Hi Ram

I think I will use a linkedcell (see properties of each checkbox)
Use cells in a row below your data.
You can hide that row

Then you can use code from this page to copy for example A50:AD50 to the database sheet
http://www.rondebruin.nl/copy1.htm

This two examples change the values to false

Sub Test1()
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Then
obj.Object.Value = False
End If
Next
End Sub

Or this one

Sub Test2()
For i = 1 To 30
ActiveSheet.OLEObjects("CheckBox" & i). _
Object.Value = False
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
ROn they are controltoolbox checkboxes, CheckBox1....CheckBox30

"Ron de Bruin" wrote:

Forms or controltoolbox checkboxes ?

Are the names something like CheckBox1....CheckBox30

--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
I have 30 check boxes on a spreadsheet I want to copy the values over to a
table to keep the history of the check box values each time the survey is
completed.

How can I Create a loop that retrives the value from each check box then
copies the value to the first blank row in my table. then changes the values
to all the checkboxes to false.

Thanks for any help












  #6   Report Post  
Posted to microsoft.public.excel.programming
Ram Ram is offline
external usenet poster
 
Posts: 138
Default Code to loop through multiple checkboxes

When I try to change the check box value i recieve the the following error
message
unable to get the oleobjects property of the worksheet class

Thanks for any help


"Ron de Bruin" wrote:

Hi Ram

I think I will use a linkedcell (see properties of each checkbox)
Use cells in a row below your data.
You can hide that row

Then you can use code from this page to copy for example A50:AD50 to the database sheet
http://www.rondebruin.nl/copy1.htm

This two examples change the values to false

Sub Test1()
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Then
obj.Object.Value = False
End If
Next
End Sub

Or this one

Sub Test2()
For i = 1 To 30
ActiveSheet.OLEObjects("CheckBox" & i). _
Object.Value = False
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
ROn they are controltoolbox checkboxes, CheckBox1....CheckBox30

"Ron de Bruin" wrote:

Forms or controltoolbox checkboxes ?

Are the names something like CheckBox1....CheckBox30

--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
I have 30 check boxes on a spreadsheet I want to copy the values over to a
table to keep the history of the check box values each time the survey is
completed.

How can I Create a loop that retrives the value from each check box then
copies the value to the first blank row in my table. then changes the values
to all the checkboxes to false.

Thanks for any help










  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Code to loop through multiple checkboxes

Test1 or test2

--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
When I try to change the check box value i recieve the the following error
message
unable to get the oleobjects property of the worksheet class

Thanks for any help


"Ron de Bruin" wrote:

Hi Ram

I think I will use a linkedcell (see properties of each checkbox)
Use cells in a row below your data.
You can hide that row

Then you can use code from this page to copy for example A50:AD50 to the database sheet
http://www.rondebruin.nl/copy1.htm

This two examples change the values to false

Sub Test1()
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Then
obj.Object.Value = False
End If
Next
End Sub

Or this one

Sub Test2()
For i = 1 To 30
ActiveSheet.OLEObjects("CheckBox" & i). _
Object.Value = False
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
ROn they are controltoolbox checkboxes, CheckBox1....CheckBox30

"Ron de Bruin" wrote:

Forms or controltoolbox checkboxes ?

Are the names something like CheckBox1....CheckBox30

--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
I have 30 check boxes on a spreadsheet I want to copy the values over to a
table to keep the history of the check box values each time the survey is
completed.

How can I Create a loop that retrives the value from each check box then
copies the value to the first blank row in my table. then changes the values
to all the checkboxes to false.

Thanks for any help












  #8   Report Post  
Posted to microsoft.public.excel.programming
Ram Ram is offline
external usenet poster
 
Posts: 138
Default Code to loop through multiple checkboxes

I deleted the first checkbox so it couldn't find check box 1. I changed the
code, now it runs fine.

Thanks again

"Ron de Bruin" wrote:

Hi Ram

I think I will use a linkedcell (see properties of each checkbox)
Use cells in a row below your data.
You can hide that row

Then you can use code from this page to copy for example A50:AD50 to the database sheet
http://www.rondebruin.nl/copy1.htm

This two examples change the values to false

Sub Test1()
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Then
obj.Object.Value = False
End If
Next
End Sub

Or this one

Sub Test2()
For i = 1 To 30
ActiveSheet.OLEObjects("CheckBox" & i). _
Object.Value = False
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
ROn they are controltoolbox checkboxes, CheckBox1....CheckBox30

"Ron de Bruin" wrote:

Forms or controltoolbox checkboxes ?

Are the names something like CheckBox1....CheckBox30

--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
I have 30 check boxes on a spreadsheet I want to copy the values over to a
table to keep the history of the check box values each time the survey is
completed.

How can I Create a loop that retrives the value from each check box then
copies the value to the first blank row in my table. then changes the values
to all the checkboxes to false.

Thanks for any help










  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Code to loop through multiple checkboxes

Note that Test1 loop through all checkboxes
So if the 30 checkboxes are the only checkboxes on the sheet use this example

No problem when you rename the checkboxes

--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
I deleted the first checkbox so it couldn't find check box 1. I changed the
code, now it runs fine.

Thanks again

"Ron de Bruin" wrote:

Hi Ram

I think I will use a linkedcell (see properties of each checkbox)
Use cells in a row below your data.
You can hide that row

Then you can use code from this page to copy for example A50:AD50 to the database sheet
http://www.rondebruin.nl/copy1.htm

This two examples change the values to false

Sub Test1()
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Then
obj.Object.Value = False
End If
Next
End Sub

Or this one

Sub Test2()
For i = 1 To 30
ActiveSheet.OLEObjects("CheckBox" & i). _
Object.Value = False
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
ROn they are controltoolbox checkboxes, CheckBox1....CheckBox30

"Ron de Bruin" wrote:

Forms or controltoolbox checkboxes ?

Are the names something like CheckBox1....CheckBox30

--
Regards Ron de Bruin
http://www.rondebruin.nl



"ram" wrote in message ...
I have 30 check boxes on a spreadsheet I want to copy the values over to a
table to keep the history of the check box values each time the survey is
completed.

How can I Create a loop that retrives the value from each check box then
copies the value to the first blank row in my table. then changes the values
to all the checkboxes to false.

Thanks for any help












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
checkboxes and code Soniya[_4_] Excel Programming 3 April 24th 05 01:08 PM
Adding checkboxes via code to a workheet Stef Excel Programming 0 February 1st 05 02:51 PM
Making All Checkboxes Run the Same Code MT DOJ Help Desk[_3_] Excel Programming 5 May 12th 04 06:24 AM
Loop for checkboxes Matt Excel Programming 8 January 13th 04 05:52 PM
For each...loop for checkboxes Steven Cheng[_3_] Excel Programming 4 August 6th 03 07:04 AM


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