Radiant_Greedy
New Member
- Joined
- Oct 11, 2021
- Messages
- 2
- Office Version
- 2019
- Platform
- Windows
My error in this code is -> lstDiplay.ColumnCount = 10
i have a list/form but didnt displayed on my Listbox that i input in userform
Private Sub cmdAddData_Click()
Dim wks As Worksheet
Dim AddNew As Range
Set wks = Sheet1
Set AddNew = wks.Range("A75356").End(xlUp).Offset(1, 0)
AddNew.Offset(0, 0).Value = txtRef.Text
AddNew.Offset(0, 1).Value = txtfirst.Text
AddNew.Offset(0, 2).Value = txtsur.Text
AddNew.Offset(0, 3).Value = txtadd.Text
AddNew.Offset(0, 4).Value = txtpost.Text
AddNew.Offset(0, 5).Value = txttel.Text
AddNew.Offset(0, 6).Value = txtdat.Text
AddNew.Offset(0, 7).Value = txtpro.Text
AddNew.Offset(0, 8).Value = txttyp.Text
AddNew.Offset(0, 9).Value = txtfee.Text
lstDiplay.ColumnCount = 10
lstDiplay.RowSource = "A1:J75356"
End Sub
Private Sub cmdExit_Click()
Dim iExit As VbMsgBoxResult
iExit = MsgBox("Confirm if you want to exit", vbQuestion + vbYesNo, "Data Entry Form")
If iExit = vbYes Then
Unload Me
End If
End Sub
Private Sub cmdReset_Click()
Dim iControl As Control
For Each iControl In Me.Controls
If iControl.Name Like "txt*" Then iControl = vbNullString
Next
End Sub
Private Sub cmdDelete_Click()
Dim i As Integer
For i = 1 To Range("A65356").End(xlUp).Row - 1
If lstDisplay.Selected(i) Then
Rows(i + 2).Select
Selection.Delete
End If
Next i
End Sub
Private Sub UserForm_Click()
End Sub
i have a list/form but didnt displayed on my Listbox that i input in userform
Private Sub cmdAddData_Click()
Dim wks As Worksheet
Dim AddNew As Range
Set wks = Sheet1
Set AddNew = wks.Range("A75356").End(xlUp).Offset(1, 0)
AddNew.Offset(0, 0).Value = txtRef.Text
AddNew.Offset(0, 1).Value = txtfirst.Text
AddNew.Offset(0, 2).Value = txtsur.Text
AddNew.Offset(0, 3).Value = txtadd.Text
AddNew.Offset(0, 4).Value = txtpost.Text
AddNew.Offset(0, 5).Value = txttel.Text
AddNew.Offset(0, 6).Value = txtdat.Text
AddNew.Offset(0, 7).Value = txtpro.Text
AddNew.Offset(0, 8).Value = txttyp.Text
AddNew.Offset(0, 9).Value = txtfee.Text
lstDiplay.ColumnCount = 10
lstDiplay.RowSource = "A1:J75356"
End Sub
Private Sub cmdExit_Click()
Dim iExit As VbMsgBoxResult
iExit = MsgBox("Confirm if you want to exit", vbQuestion + vbYesNo, "Data Entry Form")
If iExit = vbYes Then
Unload Me
End If
End Sub
Private Sub cmdReset_Click()
Dim iControl As Control
For Each iControl In Me.Controls
If iControl.Name Like "txt*" Then iControl = vbNullString
Next
End Sub
Private Sub cmdDelete_Click()
Dim i As Integer
For i = 1 To Range("A65356").End(xlUp).Row - 1
If lstDisplay.Selected(i) Then
Rows(i + 2).Select
Selection.Delete
End If
Next i
End Sub
Private Sub UserForm_Click()
End Sub