Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Assigning checkbox to the cell

I am writing a macro for a button. When I push the button, it should insert a
new row with 10 cells in a table and assign checkboxes to the last 5 cells of
the row.

In a macro how do I assign checkboxes to the cells of the new row ? Is it
possible ? Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Assigning checkbox to the cell

Which checkboxes are you using. Control Toolbox Toolbar or forms Toolbar.

You say 10 cells in a table - what does that mean. Do you mean 1 row 10
cells wide? 10 full rows. 10 rows the width of the table. How is the
table defined. Where in the table do you want the 10 rows. Where would the
checkboxes be located relative to the 10 cells. What cells would they be
linked to?

--
Regards,
Tom Ogilvy


"fbagirov" wrote:

I am writing a macro for a button. When I push the button, it should insert a
new row with 10 cells in a table and assign checkboxes to the last 5 cells of
the row.

In a macro how do I assign checkboxes to the cells of the new row ? Is it
possible ? Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Assigning checkbox to the cell

A table has 10 columns. 1 row is 10 cells wide. 5 checkboxes are in the last
5 cells of each row, one checkbox per cell.

Sorry for not making it clear.

"Tom Ogilvy" wrote:

Which checkboxes are you using. Control Toolbox Toolbar or forms Toolbar.

You say 10 cells in a table - what does that mean. Do you mean 1 row 10
cells wide? 10 full rows. 10 rows the width of the table. How is the
table defined. Where in the table do you want the 10 rows. Where would the
checkboxes be located relative to the 10 cells. What cells would they be
linked to?

--
Regards,
Tom Ogilvy


"fbagirov" wrote:

I am writing a macro for a button. When I push the button, it should insert a
new row with 10 cells in a table and assign checkboxes to the last 5 cells of
the row.

In a macro how do I assign checkboxes to the cells of the new row ? Is it
possible ? Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Assigning checkbox to the cell

Assuming you want the row inserted above the activeCell, extending to the
right.
..
Sub AddRow()
Dim rng As Range, cell As Range
Dim cbox As CheckBox, i As Long
Set rng = ActiveCell.Resize(1, 10)
rng.Interior.ColorIndex = 3
rng.Insert Shift:=xlDown
Set rng = rng.Offset(-1, 0)
For i = 6 To 10
Set cell = rng(1, i)
Set cbox = ActiveSheet.CheckBoxes.Add( _
Left:=cell.Left, _
Top:=cell.Top, _
Width:=cell.Width, _
Height:=cell.Height)
cbox.LinkedCell = cell.Address(1, 1, xlA1, True)
Next i
End Sub

--
Regards,
Tom Ogilvy


"fbagirov" wrote in message
...
A table has 10 columns. 1 row is 10 cells wide. 5 checkboxes are in the
last
5 cells of each row, one checkbox per cell.

Sorry for not making it clear.

"Tom Ogilvy" wrote:

Which checkboxes are you using. Control Toolbox Toolbar or forms
Toolbar.

You say 10 cells in a table - what does that mean. Do you mean 1 row 10
cells wide? 10 full rows. 10 rows the width of the table. How is
the
table defined. Where in the table do you want the 10 rows. Where would
the
checkboxes be located relative to the 10 cells. What cells would they
be
linked to?

--
Regards,
Tom Ogilvy


"fbagirov" wrote:

I am writing a macro for a button. When I push the button, it should
insert a
new row with 10 cells in a table and assign checkboxes to the last 5
cells of
the row.

In a macro how do I assign checkboxes to the cells of the new row ? Is
it
possible ? Thanks



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Assigning checkbox to the cell

Thanks!

The only problem is that the checkboxes show their property names
(CheckBox1, Checkbox2, etc) and when you click on them they show the value
(TRUE or FALSE) in the cell. How do I turn that off ?

Also, if the active cell is not in the first column, the code inserts the
row in whatever cell is active. how do I make it insert from the first column
of the row ?

Thanks!

"Tom Ogilvy" wrote:

Assuming you want the row inserted above the activeCell, extending to the
right.
..
Sub AddRow()
Dim rng As Range, cell As Range
Dim cbox As CheckBox, i As Long
Set rng = ActiveCell.Resize(1, 10)
rng.Interior.ColorIndex = 3
rng.Insert Shift:=xlDown
Set rng = rng.Offset(-1, 0)
For i = 6 To 10
Set cell = rng(1, i)
Set cbox = ActiveSheet.CheckBoxes.Add( _
Left:=cell.Left, _
Top:=cell.Top, _
Width:=cell.Width, _
Height:=cell.Height)
cbox.LinkedCell = cell.Address(1, 1, xlA1, True)
Next i
End Sub

--
Regards,
Tom Ogilvy


"fbagirov" wrote in message
...
A table has 10 columns. 1 row is 10 cells wide. 5 checkboxes are in the
last
5 cells of each row, one checkbox per cell.

Sorry for not making it clear.

"Tom Ogilvy" wrote:

Which checkboxes are you using. Control Toolbox Toolbar or forms
Toolbar.

You say 10 cells in a table - what does that mean. Do you mean 1 row 10
cells wide? 10 full rows. 10 rows the width of the table. How is
the
table defined. Where in the table do you want the 10 rows. Where would
the
checkboxes be located relative to the 10 cells. What cells would they
be
linked to?

--
Regards,
Tom Ogilvy


"fbagirov" wrote:

I am writing a macro for a button. When I push the button, it should
insert a
new row with 10 cells in a table and assign checkboxes to the last 5
cells of
the row.

In a macro how do I assign checkboxes to the cells of the new row ? Is
it
possible ? Thanks






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Assigning checkbox to the cell

Sub AddRow()
Dim rng As Range, cell As Range
Dim cbox As CheckBox, i As Long
Set rng = Cells(ActiveCell.row,1).Resize(1, 10)
rng.Interior.ColorIndex = 3
rng.Insert Shift:=xlDown
Set rng = rng.Offset(-1, 0)
For i = 6 To 10
Set cell = rng(1, i)
Set cbox = ActiveSheet.CheckBoxes.Add( _
Left:=cell.Left, _
Top:=cell.Top, _
Width:=cell.Width, _
Height:=cell.Height)
cbox.LinkedCell = cell.Address(1, 1, xlA1, True)
Next i
End Sub

--
regards,
Tom Ogilvy

"fbagirov" wrote in message
...
Thanks!

The only problem is that the checkboxes show their property names
(CheckBox1, Checkbox2, etc) and when you click on them they show the value
(TRUE or FALSE) in the cell. How do I turn that off ?

Also, if the active cell is not in the first column, the code inserts the
row in whatever cell is active. how do I make it insert from the first
column
of the row ?

Thanks!

"Tom Ogilvy" wrote:

Assuming you want the row inserted above the activeCell, extending to the
right.
..
Sub AddRow()
Dim rng As Range, cell As Range
Dim cbox As CheckBox, i As Long
Set rng = ActiveCell.Resize(1, 10)
rng.Interior.ColorIndex = 3
rng.Insert Shift:=xlDown
Set rng = rng.Offset(-1, 0)
For i = 6 To 10
Set cell = rng(1, i)
Set cbox = ActiveSheet.CheckBoxes.Add( _
Left:=cell.Left, _
Top:=cell.Top, _
Width:=cell.Width, _
Height:=cell.Height)
cbox.LinkedCell = cell.Address(1, 1, xlA1, True)
Next i
End Sub

--
Regards,
Tom Ogilvy


"fbagirov" wrote in message
...
A table has 10 columns. 1 row is 10 cells wide. 5 checkboxes are in the
last
5 cells of each row, one checkbox per cell.

Sorry for not making it clear.

"Tom Ogilvy" wrote:

Which checkboxes are you using. Control Toolbox Toolbar or forms
Toolbar.

You say 10 cells in a table - what does that mean. Do you mean 1 row
10
cells wide? 10 full rows. 10 rows the width of the table. How is
the
table defined. Where in the table do you want the 10 rows. Where
would
the
checkboxes be located relative to the 10 cells. What cells would
they
be
linked to?

--
Regards,
Tom Ogilvy


"fbagirov" wrote:

I am writing a macro for a button. When I push the button, it should
insert a
new row with 10 cells in a table and assign checkboxes to the last 5
cells of
the row.

In a macro how do I assign checkboxes to the cells of the new row ?
Is
it
possible ? Thanks






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
Assigning Macros to Run from a Cell Brendan Vassallo Excel Discussion (Misc queries) 1 February 12th 07 06:08 AM
assigning a value to a cell Braheem Excel Worksheet Functions 3 September 13th 06 04:42 AM
using match in vba without assigning a cell Papa Jonah Excel Programming 6 April 11th 05 09:15 PM
Assigning a value to an array cell Srikanth Ganesan[_2_] Excel Programming 1 September 17th 04 03:09 AM
Assigning click event to OleObjects checkbox Jim McLeod Excel Programming 5 April 20th 04 07:02 PM


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