Excel Data Entry Form

Radiant_Greedy

New Member
Joined
Oct 11, 2021
Messages
2
Office Version
  1. 2019
Platform
  1. 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
error.png
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
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
View attachment 48765
 

Attachments

  • working.png
    working.png
    48.4 KB · Views: 16
Upvote 0

Forum statistics

Threads
1,215,088
Messages
6,123,057
Members
449,091
Latest member
ikke

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