#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default check boxes

I have the following code that adds a checkbox to my worksheet:

Sub addcheckbox()
Dim a As String
Dim costid As String
Dim cboxname As Integer
Dim cell As Range
Dim chk As Excel.CheckBox
Set cell = ActiveCell
Set chk = cell.Parent.CheckBoxes.Add(cell.Left, cell.Top, 12, cell.Height)
costid = id
MsgBox ("costid =" & costid)
chk.Height = cell.Height - 1.5
cboxname = ActiveCell.EntireRow.Cells(13)
chk.Characters.Text = none
chk.name = "Checkbox" & costid & cboxname
chk.LinkedCell = ActiveCell.EntireRow.Cells(14).Address
ActiveCell.Select

End Sub

When I go to hide the range that contains the check box, the check box isn't
hidden. Is the a property that I need to set to hide the check box?
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 477
Default check boxes

Checkbox has a visible property - the default is True

"ranswert" wrote:

I have the following code that adds a checkbox to my worksheet:

Sub addcheckbox()
Dim a As String
Dim costid As String
Dim cboxname As Integer
Dim cell As Range
Dim chk As Excel.CheckBox
Set cell = ActiveCell
Set chk = cell.Parent.CheckBoxes.Add(cell.Left, cell.Top, 12, cell.Height)
costid = id
MsgBox ("costid =" & costid)
chk.Height = cell.Height - 1.5
cboxname = ActiveCell.EntireRow.Cells(13)
chk.Characters.Text = none
chk.name = "Checkbox" & costid & cboxname
chk.LinkedCell = ActiveCell.EntireRow.Cells(14).Address
ActiveCell.Select

End Sub

When I go to hide the range that contains the check box, the check box isn't
hidden. Is the a property that I need to set to hide the check box?
Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default check boxes

Hi ranswert,

If you are using a 'form' checkbox there are no properties available
to make it invisible but you could change the line colours etc to make
it appear to be invisible.

If you use the 'control toolbox' checkbox there is a visible property
(boolean) you can set as required.

HTH

Regards

michael beckinsale

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default check boxes

Do I need to change the visible propert to false when I want to hide the
range and to true when it is not hidden?

"michael.beckinsale" wrote:

Hi ranswert,

If you are using a 'form' checkbox there are no properties available
to make it invisible but you could change the line colours etc to make
it appear to be invisible.

If you use the 'control toolbox' checkbox there is a visible property
(boolean) you can set as required.

HTH

Regards

michael beckinsale


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default check boxes

I also am using the following code to hide everything but the range I want to
show:

Sub HideAroundSelection()
Dim intRows As Integer
Dim intCols As Integer
Dim rngAbove As Range
Dim rngRight As Range
Dim rngBelow As Range
Dim rngLeft As Range


intRows = Selection.Rows.Count
intCols = Selection.Columns.Count
MsgBox ("introws = " & intRows & vbLf & "intcols = " & intCols)
With Selection
Set rngAbove = .Cells(1, 1).Offset(-1, 0)
Set rngBelow = .Cells(1, 1).Offset(intRows, 0)
Set rngRight = .Cells(1, 1).Offset(0, intCols)
'Set rngLeft = .Cells(1, 1)

If rngAbove.Row < 1 Then
Range(rngAbove.Offset(-1, 0), .Cells(1, 1). _
Offset((1 - .Cells(1, 1).Row))).EntireRow.Hidden = True
End If
If rngBelow.Row < ActiveSheet.Rows.Count Then
MsgBox ("Entered if for rngbelow" & vbLf & "row = " &
rngBelow.Row)

Range(rngBelow.Offset(1, 0), rngBelow.Offset _
(ActiveSheet.Rows.Count - rngBelow.Row)).Select
MsgBox ("")

Range(rngBelow.Offset(1, 0), rngBelow.Offset _
(ActiveSheet.Rows.Count - rngBelow.Row)).EntireRow.Hidden = True
End If
If rngRight.Column < ActiveSheet.Columns.Count Then
Range(rngRight.Offset(0, 1), rngRight. _
Offset(0, ActiveSheet.Columns.Count -
rngRight.Column)).EntireColumn.Hidden = True
End If
'If rngLeft.Column < 1 Then
'Range(rngLeft.Offset(0, -1), rngLeft. _
'Offset(0, 1 - rngLeft.Column)).EntireColumn.Hidden = True
'End If

End With
Set rngAbove = Nothing
Set rngRight = Nothing
Set rngBelow = Nothing
Set rngLeft = Nothing


End Sub

When it get to the part where it hides the range below the selection I get
an error.
When I try to do is manually i get the error 'cannot shift objects off
sheet". Will changing the checkbox.visible property to false fix this?
Thanks
"michael.beckinsale" wrote:

Hi ranswert,

If you are using a 'form' checkbox there are no properties available
to make it invisible but you could change the line colours etc to make
it appear to be invisible.

If you use the 'control toolbox' checkbox there is a visible property
(boolean) you can set as required.

HTH

Regards

michael beckinsale




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

If you used a checkbox from the Control toolbox toolbar instead of a checkbox
from the Forms toolbar, you could change a property to move and size with cells.

You could record a macro to get the syntax.

ranswert wrote:

I have the following code that adds a checkbox to my worksheet:

Sub addcheckbox()
Dim a As String
Dim costid As String
Dim cboxname As Integer
Dim cell As Range
Dim chk As Excel.CheckBox
Set cell = ActiveCell
Set chk = cell.Parent.CheckBoxes.Add(cell.Left, cell.Top, 12, cell.Height)
costid = id
MsgBox ("costid =" & costid)
chk.Height = cell.Height - 1.5
cboxname = ActiveCell.EntireRow.Cells(13)
chk.Characters.Text = none
chk.name = "Checkbox" & costid & cboxname
chk.LinkedCell = ActiveCell.EntireRow.Cells(14).Address
ActiveCell.Select

End Sub

When I go to hide the range that contains the check box, the check box isn't
hidden. Is the a property that I need to set to hide the check box?
Thanks


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default check boxes

I tried to do that but that I am not able to select that option. I am able
to select the other two options.

"Dave Peterson" wrote:

If you used a checkbox from the Control toolbox toolbar instead of a checkbox
from the Forms toolbar, you could change a property to move and size with cells.

You could record a macro to get the syntax.

ranswert wrote:

I have the following code that adds a checkbox to my worksheet:

Sub addcheckbox()
Dim a As String
Dim costid As String
Dim cboxname As Integer
Dim cell As Range
Dim chk As Excel.CheckBox
Set cell = ActiveCell
Set chk = cell.Parent.CheckBoxes.Add(cell.Left, cell.Top, 12, cell.Height)
costid = id
MsgBox ("costid =" & costid)
chk.Height = cell.Height - 1.5
cboxname = ActiveCell.EntireRow.Cells(13)
chk.Characters.Text = none
chk.name = "Checkbox" & costid & cboxname
chk.LinkedCell = ActiveCell.EntireRow.Cells(14).Address
ActiveCell.Select

End Sub

When I go to hide the range that contains the check box, the check box isn't
hidden. Is the a property that I need to set to hide the check box?
Thanks


--

Dave Peterson

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default check boxes

Try it using the checkbox from the Control toolbar toolbar--not the Forms
toolbar.

ranswert wrote:

I tried to do that but that I am not able to select that option. I am able
to select the other two options.

"Dave Peterson" wrote:

If you used a checkbox from the Control toolbox toolbar instead of a checkbox
from the Forms toolbar, you could change a property to move and size with cells.

You could record a macro to get the syntax.

ranswert wrote:

I have the following code that adds a checkbox to my worksheet:

Sub addcheckbox()
Dim a As String
Dim costid As String
Dim cboxname As Integer
Dim cell As Range
Dim chk As Excel.CheckBox
Set cell = ActiveCell
Set chk = cell.Parent.CheckBoxes.Add(cell.Left, cell.Top, 12, cell.Height)
costid = id
MsgBox ("costid =" & costid)
chk.Height = cell.Height - 1.5
cboxname = ActiveCell.EntireRow.Cells(13)
chk.Characters.Text = none
chk.name = "Checkbox" & costid & cboxname
chk.LinkedCell = ActiveCell.EntireRow.Cells(14).Address
ActiveCell.Select

End Sub

When I go to hide the range that contains the check box, the check box isn't
hidden. Is the a property that I need to set to hide the check box?
Thanks


--

Dave Peterson


--

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
Copy and move check box (check boxes) with new cell link? Marty Excel Worksheet Functions 1 January 20th 10 07:43 PM
all the check boxes should be checked if i check a particular checkbox in that row [email protected] Excel Programming 3 April 18th 07 09:20 AM
How do I increase the size of check in check boxes Adams, Les Excel Discussion (Misc queries) 0 September 19th 06 02:35 PM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM
How do i create a value for check boxes or option boxes Tim wr Excel Discussion (Misc queries) 1 February 9th 06 10:29 PM


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