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
'-----------------------------------------------------------
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
'-----------------------------------------------------------