checkbox

tokhimi

Board Regular
Joined
Jul 10, 2010
Messages
61
Help me in 24 checkbox and 24 textbox

1. From load 24 checkbox and textbox visible false
2. Combobox change then checkbox(cb) visible true <>""
Dim ws As Worksheet
Dim K As Long
Set ws = Worksheets("RMAList")
For K = 1 To 24
Me.Controls("cb" & K).Caption = ws.Range("SKURMAList").Cells(ComboBox1.ListIndex + 1, K + 1).Value

If Me.Controls("cb" & K).Caption <> "" Then
Me.Controls("cb" & K).Visible = True
Else
Me.Controls("cb" & K).Visible = False
End If
Next K

3. if my data have 24 so that checkbox 24 visible true with value

how to let if only 1 and 2 only checked then the textbox 1and 2 also visible true for Qty key , after done keying cmd click then caption value in checkbox 1 and 2 drop in sheet other sheets 2 column A follow with textbox 1 and 2 in the same sheets 2 column B


Below is my code please see and help me on checkbox and the textbox and cmd button click code..

"""""""""""
'-----------------------------------------------------------
Private Sub cb1_Change()
If cb1.Value = True Then
tb1.Visible = True
Else
tb1.Visible = False
End If
End Sub
''''''(((( how to write if the checkbox 1 to 24 check then textbox 1 to 24 visible true
'------------------------------------------------------------
Private Sub ComboBox1_Change()
Dim ws As Worksheet
Dim K As Long
Set ws = Worksheets("RMAList")
For K = 1 To 24

Me.Controls("cb" & K).Caption = ws.Range("SKURMAList").Cells(ComboBox1.ListIndex + 1, K + 1).Value

If Me.Controls("cb" & K).Caption <> "" Then
Me.Controls("cb" & K).Visible = True
Else
Me.Controls("cb" & K).Visible = False
End If
Next K
End Sub
'-----------------------------------------------------------
Private Sub OptionButton1_Click()
' readings for Inventory
If OptionButton1.Value = True Then
OptionButton2.Value = False
End If
End Sub
'-----------------------------------------------------------
Private Sub OptionButton2_Click()
' readings for Inventory2
If OptionButton2.Value = True Then
OptionButton1.Value = False
End If
End Sub
'-----------------------------------------------------------
' Prevent closure of userform using x
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
MsgBox "You cannot Close this application in this manner" & vbLf & " Please use the Close button on the Application", vbCritical
End If
End Sub
'-----------------------------------------------------------
' Set startup screen size
Private Sub UserForm_Initialize()
Dim K As Long
For K = 1 To 24
If Me.Controls("cb" & K).Value = True Then
Me.Controls("tb" & K).Visible = True
Else
Me.Controls("tb" & K).Visible = False
End If
Next K
With Application
.WindowState = xlMaximized
Zoom = Int(.Width / Me.Width * 100)
Width = .Width
Height = .Height
End With

Dim Sh As Worksheet
Dim Rng1 As Range
Set Sh = Worksheets("RMAList")
With Sh
Set Rng1 = .Range("A2:A" & .Range("A2").End(xlDown).Row)
ComboBox1.List = Rng1.Value
End With

For Each ctl In Me.Controls
If TypeName(ctl) = "cb" Then
ctl.Visible = False
End If
Next ctl
OptionButton1.Value = True
OptionButton2.Value = False
End Sub
'-----------------------------------------------------------
Private Sub CommandButton2_Click()
ListView1.ListItems.Clear
ListView1.ColumnHeaders.Clear
If OptionButton1.Value = True Then
Sheets("Efox Inventory").Activate
nextRow = Application.WorksheetFunction.CountA(Range("A:A")) + 1
End If

If OptionButton2.Value = True Then
Sheets("Efox Inventory2").Activate
nextRow = Application.WorksheetFunction.CountA(Range("A:A")) + 1
End If

Dim K As Long
For K = 1 To 24
Cells(nextRow, 4) = ComboBox1.Value
Cells(nextRow, 1) = TxtBox1.Value
Cells(nextRow, 8) = TxtBox2.Value
'''''''(((((((help me on this checkbox drop in (nextRow,2)=.("cb"& K ).value
'''''''(((((((help me on this checkbox drop in (nextRow,6)=.("cb"& K ).value
Next
End Sub
'-----------------------------------------------------------
Private Sub CommandButton1_Click()
MsgBox "Closing Down" & vbLf & " Press OK to Closedown"
'ActiveWorkbook.Save
'Application.Quit
Unload Me
Sheets("Screen").Select
End Sub
'-----------------------------------------------------------
Private Sub txtbox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Asc("0") To Asc("9")
Case Asc("-")
If InStr(1, Me.TxtBox1.Text, "-") > 0 Or Me.TxtBox1.SelStart > 0 Then
KeyAscii = 0
End If
Case Asc(".")
If InStr(1, Me.TxtBox1.Text, ".") > 0 Then
KeyAscii = 0
End If
Case Else
KeyAscii = 0
End Select
End Sub
'-----------------------------------------------------------
Private Sub txtbox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Asc("0") To Asc("9")
Case Asc("-")
If InStr(1, Me.TxtBox1.Text, "-") > 0 Or Me.TxtBox1.SelStart > 0 Then
KeyAscii = 0
End If
Case Asc(".")
If InStr(1, Me.TxtBox1.Text, ".") > 0 Then
KeyAscii = 0
End If
Case Else
KeyAscii = 0
End Select
End Sub
'-----------------------------------------------------------
Public Sub E()
SQL = "select * from [Efox Inventory$] "
With Sheets("Efox Inventory")
ListView1.ColumnHeaders.Add 1, , .Cells(1, 1), ListView1.Width * 0.25
ListView1.ColumnHeaders.Add 2, , .Cells(1, 2), ListView1.Width * 0.3, lvwColumnCenter
ListView1.ColumnHeaders.Add 3, , .Cells(1, 4), ListView1.Width * 0.3, lvwColumnCenter
ListView1.ColumnHeaders.Add 4, , .Cells(1, 6), ListView1.Width * 0.2, lvwColumnCenter
ListView1.ColumnHeaders.Add 5, , .Cells(1, 8), ListView1.Width * 0.2, lvwColumnCenter

ListView1.View = lvwReport
ListView1.Gridlines = True
ListView1.FullRowSelect = True 'ÕûÐÐÑ¡È¡
For I = 2 To .[A65536].End(xlUp).Row
Set ITM = ListView1.ListItems.Add()
ITM.Text = .Cells(I, 1)
ITM.SubItems(1) = .Cells(I, 2)
ITM.SubItems(2) = .Cells(I, 4)
ITM.SubItems(3) = .Cells(I, 6)
ITM.SubItems(4) = .Cells(I, 8)
Next I
End With
End Sub
'-----------------------------------------------------------
Public Sub E2()
SQL = "select * from [Efox Inventory2$] "
With Sheets("Efox Inventory2")
ListView1.ColumnHeaders.Add 1, , .Cells(1, 1), ListView1.Width * 0.25
ListView1.ColumnHeaders.Add 2, , .Cells(1, 2), ListView1.Width * 0.3, lvwColumnCenter
ListView1.ColumnHeaders.Add 3, , .Cells(1, 4), ListView1.Width * 0.3, lvwColumnCenter
ListView1.ColumnHeaders.Add 4, , .Cells(1, 6), ListView1.Width * 0.2, lvwColumnCenter
ListView1.ColumnHeaders.Add 5, , .Cells(1, 8), ListView1.Width * 0.2, lvwColumnCenter

ListView1.View = lvwReport
ListView1.Gridlines = True
ListView1.FullRowSelect = True 'ÕûÐÐÑ¡È¡
For I = 2 To .[A65536].End(xlUp).Row
Set ITM = ListView1.ListItems.Add()
ITM.Text = .Cells(I, 1)
ITM.SubItems(1) = .Cells(I, 2)
ITM.SubItems(2) = .Cells(I, 4)
ITM.SubItems(3) = .Cells(I, 6)
ITM.SubItems(4) = .Cells(I, 8)
Next I
End With
End Sub
'-----------------------------------------------------------
Private Sub OptionButton1_Change()
' readings for Efox Inventory
If OptionButton1.Value = True Then
OptionButton2.Value = False
ListView1.ListItems.Clear
ListView1.ColumnHeaders.Clear
End If
Call E
End Sub
'-----------------------------------------------------------
Private Sub OptionButton2_Change()
' readings for Efox Inventory2
If OptionButton2.Value = True Then
OptionButton1.Value = False
ListView1.ListItems.Clear
ListView1.ColumnHeaders.Clear
End If
Call E2
End Sub
'-----------------------------------------------------------
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi,
With the visible settings you would need to check each one under each change event.

eg:

Code:
if checkbox1.visible = true then
textbox1.visible = true
else if checkbox2.visible = true then
textbox2.visible = true

etc etc all the way down to 24
 
Upvote 0
Hi Ben


if checkbox1.visible = true thentextbox1.visible = trueelse if checkbox2.visible = true thentextbox2.visible = true</PRE>Other the all the way down to 24, have any any simple way.

meanwhile i need to know how to write for command button add
if checkbox1 checked value in checkbox1 and textbox1 value drop to sheets

For K = 1 To 24
'''''''(((((((help me on this checkbox drop in (nextRow,2)=.("checkbox"& K ).value
'''''''(((((((help me on this checkbox drop in (nextRow,6)=.("textbox"& K ).value
 
Upvote 0
If checkbox checked
For K = 1 to 24
'''''''(((((((help me on this checkbox drop in (nextRow,2)=.("checkbox"& K ).value
'''''''(((((((help me on this checkbox drop in (nextRow,6)=.("textbox"& K ).value
 
Upvote 0
If checkbox checked
For K = 1 to 24
'''''''(((((((help me on this checkbox drop in (nextRow,2)=.("checkbox"& K ).value
'''''''(((((((help me on this checkbox drop in (nextRow,6)=.("textbox"& K ).value

Who can help me
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,486
Members
452,917
Latest member
MrsMSalt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top