![]() |
Userform - 100 checkbox (10X10)
Hi,
Is there a way to make a listview or something else that will contains 10 rows and 10 columns of checkbox only? So, the listview could contains 100 cases to click. Thank you! Alex -- Alex St-Pierre |
Userform - 100 checkbox (10X10)
You can put them directly onto a worksheet.
"Alex St-Pierre" wrote: Hi, Is there a way to make a listview or something else that will contains 10 rows and 10 columns of checkbox only? So, the listview could contains 100 cases to click. Thank you! Alex -- Alex St-Pierre |
Userform - 100 checkbox (10X10)
This adds to a form with a scrollable frame 100 checkboxes.
Create a UserForm, Frame (Frame1), CommandButton (CommandButton1) and stick the code behind the form: Private Sub CommandButton1_Click() Dim x As Integer, y As Integer Dim chk As MSForms.CheckBox, dblBuffer As Double Dim TopPos As Double, LeftPos As Double, OrigLeft As Double Frame1.ScrollBars = fmScrollBarsBoth ' Adjust the initial left and top to adjust ' the initial starting (top left) starting point OrigLeft = 5: TopPos = 5: LeftPos = OrigLeft ' Adjust the buffer to adjust the spacing between the controls dblBuffer = 2 For x = 1 To 10 For y = 1 To 10 Set chk = Me.AddCheckbox(TopPos:=TopPos, LeftPos:=LeftPos, Width:=15) LeftPos = LeftPos + chk.Width + dblBuffer Frame1.ScrollWidth = LeftPos + chk.Width Next TopPos = chk.Top + chk.Height + dblBuffer LeftPos = OrigLeft Frame1.ScrollHeight = chk.Top + chk.Height Next End Sub Function AddCheckbox(ByVal TopPos As Double, ByVal LeftPos As Double, ByVal Width As Double, _ Optional ByVal Height As Double = 18) As MSForms.CheckBox Dim Ctrl As MSForms.CheckBox Set Ctrl = Me.Frame1.Controls.Add("Forms.Checkbox.1", "") With Ctrl .Top = TopPos .Left = LeftPos .Width = Width .Height = Height End With Set AddCheckbox = Ctrl End Function -- Tim Zych SF, CA "Alex St-Pierre" wrote in message ... Hi, Is there a way to make a listview or something else that will contains 10 rows and 10 columns of checkbox only? So, the listview could contains 100 cases to click. Thank you! Alex -- Alex St-Pierre |
Userform - 100 checkbox (10X10)
It works well !! I'm wondering if there's a way to place each checkbox inside
a listview cases? Thanks! Alex -- Alex St-Pierre "Tim Zych" wrote: This adds to a form with a scrollable frame 100 checkboxes. Create a UserForm, Frame (Frame1), CommandButton (CommandButton1) and stick the code behind the form: Private Sub CommandButton1_Click() Dim x As Integer, y As Integer Dim chk As MSForms.CheckBox, dblBuffer As Double Dim TopPos As Double, LeftPos As Double, OrigLeft As Double Frame1.ScrollBars = fmScrollBarsBoth ' Adjust the initial left and top to adjust ' the initial starting (top left) starting point OrigLeft = 5: TopPos = 5: LeftPos = OrigLeft ' Adjust the buffer to adjust the spacing between the controls dblBuffer = 2 For x = 1 To 10 For y = 1 To 10 Set chk = Me.AddCheckbox(TopPos:=TopPos, LeftPos:=LeftPos, Width:=15) LeftPos = LeftPos + chk.Width + dblBuffer Frame1.ScrollWidth = LeftPos + chk.Width Next TopPos = chk.Top + chk.Height + dblBuffer LeftPos = OrigLeft Frame1.ScrollHeight = chk.Top + chk.Height Next End Sub Function AddCheckbox(ByVal TopPos As Double, ByVal LeftPos As Double, ByVal Width As Double, _ Optional ByVal Height As Double = 18) As MSForms.CheckBox Dim Ctrl As MSForms.CheckBox Set Ctrl = Me.Frame1.Controls.Add("Forms.Checkbox.1", "") With Ctrl .Top = TopPos .Left = LeftPos .Width = Width .Height = Height End With Set AddCheckbox = Ctrl End Function -- Tim Zych SF, CA "Alex St-Pierre" wrote in message ... Hi, Is there a way to make a listview or something else that will contains 10 rows and 10 columns of checkbox only? So, the listview could contains 100 cases to click. Thank you! Alex -- Alex St-Pierre |
Userform - 100 checkbox (10X10)
Maybe, I shouldn't use the listview and align the text with the checkbox..!
-- Alex St-Pierre "Alex St-Pierre" wrote: It works well !! I'm wondering if there's a way to place each checkbox inside a listview cases? Thanks! Alex -- Alex St-Pierre "Tim Zych" wrote: This adds to a form with a scrollable frame 100 checkboxes. Create a UserForm, Frame (Frame1), CommandButton (CommandButton1) and stick the code behind the form: Private Sub CommandButton1_Click() Dim x As Integer, y As Integer Dim chk As MSForms.CheckBox, dblBuffer As Double Dim TopPos As Double, LeftPos As Double, OrigLeft As Double Frame1.ScrollBars = fmScrollBarsBoth ' Adjust the initial left and top to adjust ' the initial starting (top left) starting point OrigLeft = 5: TopPos = 5: LeftPos = OrigLeft ' Adjust the buffer to adjust the spacing between the controls dblBuffer = 2 For x = 1 To 10 For y = 1 To 10 Set chk = Me.AddCheckbox(TopPos:=TopPos, LeftPos:=LeftPos, Width:=15) LeftPos = LeftPos + chk.Width + dblBuffer Frame1.ScrollWidth = LeftPos + chk.Width Next TopPos = chk.Top + chk.Height + dblBuffer LeftPos = OrigLeft Frame1.ScrollHeight = chk.Top + chk.Height Next End Sub Function AddCheckbox(ByVal TopPos As Double, ByVal LeftPos As Double, ByVal Width As Double, _ Optional ByVal Height As Double = 18) As MSForms.CheckBox Dim Ctrl As MSForms.CheckBox Set Ctrl = Me.Frame1.Controls.Add("Forms.Checkbox.1", "") With Ctrl .Top = TopPos .Left = LeftPos .Width = Width .Height = Height End With Set AddCheckbox = Ctrl End Function -- Tim Zych SF, CA "Alex St-Pierre" wrote in message ... Hi, Is there a way to make a listview or something else that will contains 10 rows and 10 columns of checkbox only? So, the listview could contains 100 cases to click. Thank you! Alex -- Alex St-Pierre |
All times are GMT +1. The time now is 12:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com