snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Private Sub UserForm_Activate()
Dim j As Long
j = 1
Do While Sheets("Sheet2").Cells(j, 1).Value
j = j + 1
Loop
Me.ListBox1.RowSource = "Sheet2!A1:A" & (j - 1)
End Sub
Private Sub UserForm2_Initialize()
Dim a As Integer
Dim f As Integer
For a = 2 To 1000
If Oat5.Cells(i, 1) = "" Then
f = a - 1
Exit For
End If
Next
ListBox1.AddItem = Oat5.Cells(f, 1)
Next
End Sub
Private Sub UserForm_Initialize()
Dim cl As Range
'Load the combobox with a variety of household pets
With Me.ListBox1
'Clear the rowsource in case it has been set
.RowSource = ""
'Add the items from Cell A10 to the last used row in column A
For Each cl In Worksheets("Oat2").Range("A2:A" & _
Worksheets("Oat2").Range("A65536").End(xlUp).Row)
.AddItem cl.Value
Next cl
End With
End Sub
Private Sub CommandButton1_Click()
Dim validar As Boolean
Dim validarfecha As Boolean
If TextBox1 = "" Then
UserForm10.Show
Exit Sub
End If
If TextBox2 = "" Then
UserForm11.Show
Exit Sub
End If
If TextBox4 = "" Then
UserForm12.Show
Exit Sub
End If
If TextBox6 = "" Then
UserForm13.Show
Exit Sub
End If
If TextBox7 = "" Then
UserForm14.Show
Exit Sub
End If
validar = IsNumeric(TextBox2.Value)
If validar = False Then
UserForm22.Show
TextBox2.BackColor = &HFF00&
Exit Sub
End If
validarfecha = IsDate(TextBox6.Value)
If validarfecha = False Then
UserForm23.Show
TextBox6.BackColor = &HFF00&
Exit Sub
End If
If TextBox2 <> "" And TextBox1 <> "" And TextBox4 <> "" And TextBox6 <> "" And TextBox7 <> "" Then
TextBox2.BackColor = -2147483643
TextBox6.BackColor = -2147483643
UserForm15.Show
End If
End Sub
Private Sub CommandButton2_Click()
UserForm2.Hide
End Sub
Private Sub CommandButton3_Click()
UserForm30.Show
End Sub
Private Sub UserForm_Initialize()
Dim cl As Range
'Load the combobox with a variety of household pets
With Me.ListBox1
'Clear the rowsource in case it has been set
.RowSource = ""
'Add the items from Cell A10 to the last used row in column A
For Each cl In Oat5.Range("A2:A" & _
Oat5.Range("A65536").End(xlUp).Row)
.AddItem cl.Value
Next cl
End With
End Sub
Private Sub UserForm_Initialize()
Dim cl As Range
'Load the combobox with a variety of household pets
With Me.ListBox1
'Clear the rowsource in case it has been set
.RowSource = ""
'Add the items from Cell A10 to the last used row in column A
For Each cl In Worksheets("NOTEBOOK").Range("A2:A" & _
Worksheets("NOTEBOOK").Range("A65536").End(xlUp).Row)
.AddItem cl.Value
Next cl
End With
End Sub