Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Autofill for checkboxes

In my spreadsheet I need 177 checkboxes all linked to the cell they reside
in. Is there a way to make one checkbox link it to the right cell and then
autofill the other 176 checkboxes? The way I'm doing it now is not working
as I have to make the link to the respective checkbox 176 times checkbox for
checkbox.
thanks,
john


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Autofill for checkboxes

do you want the cell to change when the checkbox is change or vice
versa?
john wrote:
In my spreadsheet I need 177 checkboxes all linked to the cell they reside
in. Is there a way to make one checkbox link it to the right cell and then
autofill the other 176 checkboxes? The way I'm doing it now is not working
as I have to make the link to the respective checkbox 176 times checkbox for
checkbox.
thanks,
john


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Autofill for checkboxes

I want the cell to change when the checkbox is changed and I have got that
working for one checkbox and the respective cell. Maybe Autofill isn't the
right word but I want to select the left-right-corner of the first cell with
the checkbox and drag it 176 cells further so that 176 checkboxes are made
and related to the cell they reside in.

"stevebriz" schreef in bericht
oups.com...
do you want the cell to change when the checkbox is change or vice
versa?
john wrote:
In my spreadsheet I need 177 checkboxes all linked to the cell they
reside
in. Is there a way to make one checkbox link it to the right cell and
then
autofill the other 176 checkboxes? The way I'm doing it now is not
working
as I have to make the link to the respective checkbox 176 times checkbox
for
checkbox.
thanks,
john




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Autofill for checkboxes

You can do somethhing like this with macros enabled and the macro
below.

call this sub on the click event of each check box.
this works for sheet1..but you can change the name to another in the
code if you like.
(Ps it works for checkboxes on sheet1 - an they all update on every
click of a check box)

' eg for :
sub checkbox1_click()
call test1
End sub



'------- Macro--------------------
Sub test1()
Dim ctl As OLEObject
''Dim sPath As String
i = 1
'sPath = "C:Documents and SettingsDickMy DocumentsTester"

For Each ctl In Sheet1.OLEObjects

If TypeName(ctl.Object) = "CheckBox" Then
If ctl.Object.Value = True Then
Sheet1.Cells(i, 1).Value = "TRUE"
Else
If ctl.Object.Value = False Then Sheet1.Cells(i,
1).Value = "FALSE"
End If
End If
i = i + 1
Next ctl
End sub
'------------------END---------------------------------------------
'Hope this helps


End Sub
john wrote:
I want the cell to change when the checkbox is changed and I have got that
working for one checkbox and the respective cell. Maybe Autofill isn't the
right word but I want to select the left-right-corner of the first cell with
the checkbox and drag it 176 cells further so that 176 checkboxes are made
and related to the cell they reside in.

"stevebriz" schreef in bericht
oups.com...
do you want the cell to change when the checkbox is change or vice
versa?
john wrote:
In my spreadsheet I need 177 checkboxes all linked to the cell they
reside
in. Is there a way to make one checkbox link it to the right cell and
then
autofill the other 176 checkboxes? The way I'm doing it now is not
working
as I have to make the link to the respective checkbox 176 times checkbox
for
checkbox.
thanks,
john



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Autofill for checkboxes

Thanks guys.
Unfortunately that's not exactly what I'm looking for.
Let's say I have linked the first checkbox in A1 to the value in A1 so if I
check and uncheck that checkbox the value toggles between true and false.
Now I would like to select the right-below corner of A1 and drag it to F1 in
a way that all cells relate to the checkbox that is in the respective cell
(checkbox in cell B2 relates to cell B2).
Another question: how can you select more than one checkbox and delete them?
john

"john" schreef in bericht
...
I want the cell to change when the checkbox is changed and I have got that
working for one checkbox and the respective cell. Maybe Autofill isn't the
right word but I want to select the left-right-corner of the first cell
with the checkbox and drag it 176 cells further so that 176 checkboxes are
made and related to the cell they reside in.

"stevebriz" schreef in bericht
oups.com...
do you want the cell to change when the checkbox is change or vice
versa?
john wrote:
In my spreadsheet I need 177 checkboxes all linked to the cell they
reside
in. Is there a way to make one checkbox link it to the right cell and
then
autofill the other 176 checkboxes? The way I'm doing it now is not
working
as I have to make the link to the respective checkbox 176 times checkbox
for
checkbox.
thanks,
john








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Autofill for checkboxes

Saved from a previous post:

Here are two subroutines. The first one adds a bunch of checkboxes from the
Forms toolbar to a range in the activesheet (b3:B10).

The second one is the one that would do what you want to do when you
check/uncheck that box.

The first one only needs to be run once--to set up the checkboxes on the
worksheet.

Option Explicit
Sub testme()

Dim myCBX As CheckBox
Dim myCell As Range

With ActiveSheet
.CheckBoxes.Delete
For Each myCell In ActiveSheet.Range("B3:B10").Cells

With myCell
Set myCBX = .Parent.CheckBoxes.Add _
(Top:=.Top, Width:=.Width, _
Left:=.Left, Height:=.Height)
With myCBX
'.LinkedCell = myCell.Offset(0, 10).Address(external:=True)
.Caption = ""
.Name = "CBX_" & myCell.Address(0, 0)
.OnAction = "'" & ThisWorkbook.Name & "'!dothework"
End With
.NumberFormat = ";;;"
End With

Next myCell
End With
End Sub

Sub DoTheWork()
Dim myCBX As CheckBox
Set myCBX = ActiveSheet.CheckBoxes(Application.Caller)

If myCBX = xlOn Then
'do something
Else
'do something else
End If

End Sub

If you don't need a procedure to run when you check/uncheck that checkbox, don't
include the "doTheWork" subroutine and delete the .OnAction line.

And change this line
For Each myCell In ActiveSheet.Range("B3:B10").Cells
to use the range that should get the checkboxes.

john wrote:

In my spreadsheet I need 177 checkboxes all linked to the cell they reside
in. Is there a way to make one checkbox link it to the right cell and then
autofill the other 176 checkboxes? The way I'm doing it now is not working
as I have to make the link to the respective checkbox 176 times checkbox for
checkbox.
thanks,
john


--

Dave Peterson
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 Robbyn Excel Programming 2 June 13th 06 06:25 PM
Autofill: Need to autofill one week block, (5) weekday only into cells. dstock Excel Discussion (Misc queries) 1 June 17th 05 08:21 PM
Q. Autofill question: Can I autofill alpha characters like I can numbers? George[_22_] Excel Programming 5 August 7th 04 10:33 AM
checkboxes marksuza[_3_] Excel Programming 3 December 11th 03 03:19 PM
Checkboxes Tom Ogilvy Excel Programming 0 August 11th 03 05:45 PM


All times are GMT +1. The time now is 09:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"