Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default dynamically creating check boxes

I want to have a column in my spreadsheet that contains a
check box. I need to dynamically create this once the
spreadsheet is populated from the database. I am doing
this by copying a dummy one I have on a hidden sheet with
the following code:

Sub CreateCheckBoxes()
NumRows = Range("B4").CurrentRegion.Rows.Count + 4
For x = 5 To NumRows
Sheets("Input Data").Shapes("chkView").Copy
Range("J" & x).Select
ActiveSheet.Paste
Selection.Name = "chkView" & Range("A" & x).Value
Next x
End Sub

I want the check box to be in each row of the J column.
But, it doesn't place it here.
Anyone know how to force the check box to do into a
particular cell without hard-coding the position
coordinates?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default dynamically creating check boxes

You say without hard code the position settings, but why not? Why struggle?

Sub CreateCheckBoxes()
NumRows = Range("B4").CurrentRegion.Rows.Count + 4
For x = 5 To NumRows
Sheets("Input Data").Shapes("chkView").Copy
Range("J" & x).Select
ActiveSheet.Paste
Selection.Name = "chkView" & Range("A" & x).Value
With Range("J" & x)
selection.Top = .Top
selection.Left = .Left
' and possibly
'selection.Height = .Height
'selection.Width = .Width
End With
Next x
End Sub

--
Regards,
Tom Ogilvy

"Erin" wrote in message
...
I want to have a column in my spreadsheet that contains a
check box. I need to dynamically create this once the
spreadsheet is populated from the database. I am doing
this by copying a dummy one I have on a hidden sheet with
the following code:

Sub CreateCheckBoxes()
NumRows = Range("B4").CurrentRegion.Rows.Count + 4
For x = 5 To NumRows
Sheets("Input Data").Shapes("chkView").Copy
Range("J" & x).Select
ActiveSheet.Paste
Selection.Name = "chkView" & Range("A" & x).Value
Next x
End Sub

I want the check box to be in each row of the J column.
But, it doesn't place it here.
Anyone know how to force the check box to do into a
particular cell without hard-coding the position
coordinates?



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

Your solution is perfect, and just what I needed to do.
And I don't consider this hard-coding at all, since it is
dynamically placed at the cell coordinates of the
appropriate cell.

THANKS!
-----Original Message-----
You say without hard code the position settings, but why

not? Why struggle?

Sub CreateCheckBoxes()
NumRows = Range("B4").CurrentRegion.Rows.Count + 4
For x = 5 To NumRows
Sheets("Input Data").Shapes("chkView").Copy
Range("J" & x).Select
ActiveSheet.Paste
Selection.Name = "chkView" & Range("A" & x).Value
With Range("J" & x)
selection.Top = .Top
selection.Left = .Left
' and possibly
'selection.Height = .Height
'selection.Width = .Width
End With
Next x
End Sub

--
Regards,
Tom Ogilvy

"Erin" wrote in

message
...
I want to have a column in my spreadsheet that contains

a
check box. I need to dynamically create this once the
spreadsheet is populated from the database. I am doing
this by copying a dummy one I have on a hidden sheet

with
the following code:

Sub CreateCheckBoxes()
NumRows = Range("B4").CurrentRegion.Rows.Count + 4
For x = 5 To NumRows
Sheets("Input Data").Shapes("chkView").Copy
Range("J" & x).Select
ActiveSheet.Paste
Selection.Name = "chkView" & Range("A" &

x).Value
Next x
End Sub

I want the check box to be in each row of the J column.
But, it doesn't place it here.
Anyone know how to force the check box to do into a
particular cell without hard-coding the position
coordinates?



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default dynamically creating check boxes

Different interpretation of hard-coding <g now is see what you were
saying.

--
Regards,
Tom Ogilvy
]
"Erin" wrote in message
...
Your solution is perfect, and just what I needed to do.
And I don't consider this hard-coding at all, since it is
dynamically placed at the cell coordinates of the
appropriate cell.

THANKS!
-----Original Message-----
You say without hard code the position settings, but why

not? Why struggle?

Sub CreateCheckBoxes()
NumRows = Range("B4").CurrentRegion.Rows.Count + 4
For x = 5 To NumRows
Sheets("Input Data").Shapes("chkView").Copy
Range("J" & x).Select
ActiveSheet.Paste
Selection.Name = "chkView" & Range("A" & x).Value
With Range("J" & x)
selection.Top = .Top
selection.Left = .Left
' and possibly
'selection.Height = .Height
'selection.Width = .Width
End With
Next x
End Sub

--
Regards,
Tom Ogilvy

"Erin" wrote in

message
...
I want to have a column in my spreadsheet that contains

a
check box. I need to dynamically create this once the
spreadsheet is populated from the database. I am doing
this by copying a dummy one I have on a hidden sheet

with
the following code:

Sub CreateCheckBoxes()
NumRows = Range("B4").CurrentRegion.Rows.Count + 4
For x = 5 To NumRows
Sheets("Input Data").Shapes("chkView").Copy
Range("J" & x).Select
ActiveSheet.Paste
Selection.Name = "chkView" & Range("A" &

x).Value
Next x
End Sub

I want the check box to be in each row of the J column.
But, it doesn't place it here.
Anyone know how to force the check box to do into a
particular cell without hard-coding the position
coordinates?



.



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
Creating checkable boxes w/o the check box forms tool crimsontodd Excel Worksheet Functions 0 August 26th 08 05:38 AM
Creating fillalbe check boxes in excel by double clicking on chec. Meme Excel Discussion (Misc queries) 0 April 9th 08 09:00 PM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM
Creating Formula using check boxes Anthony Slater Excel Discussion (Misc queries) 3 January 4th 05 03:03 PM


All times are GMT +1. The time now is 08:42 PM.

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"