himaruasuka
New Member
- Joined
- May 26, 2022
- Messages
- 12
- Office Version
- 2013
- Platform
- Windows
- Mobile
Good day! I need some help, I'm nearly done with my excel sheet but what just happen now was, when I submit the Data Entry, it will added to the list, but after that, I noticed some irregularities, like can't use the combobox, can't type, can't scroll, and after 1 minute, my excel file is automatically restarted. It seems that there is some error in my codes because when I added it, i only get this error.
This is the Entry Form
This is the Datasheet
and I also noticed some problem, in range(1), I have put some Conditional Formatting to put a color.. Delivered as grey, Pending as Red, For Delivery as Green.. But when I added some data in the queue, the color is malfunctioning? all data I put in: delivered, pending, for delivery, it appears to always color green. What happen? anyone who could help me? Thanks in Advance !
VBA Code:
Private Sub pos_checkout_Click()
' For Validation
If pos_cmbx_name.Value = "" Then
MsgBox "Please Select Product", vbCritical
Exit Sub
End If
If pos_quantity.Value = "" Then
MsgBox "Please Enter Quantity", vbCritical
Exit Sub
End If
If pos_customer.Value = "" Then
MsgBox "Please Enter Customer Name", vbCritical
Exit Sub
End If
If pos_address.Value = "" Then
MsgBox "Please Enter Customer's Address", vbCritical
Exit Sub
End If
If pos_contact.Value = "" Then
MsgBox "Please Enter Customer's Contact", vbCritical
Exit Sub
End If
If pos_other.Value = "" Then
MsgBox "Please Enter Customer's Other Contact", vbCritical
Exit Sub
End If
Worksheets("Home").Unprotect "Roshier"
Dim ans As Integer
ans = MsgBox("Order will be added in the queue, you want to proceed?", vbQuestion + vbYesNo + vbDefaultButton2, "Order Validation")
If ans = vbYes Then
Dim sh As Worksheet
Set sh = ActiveWorkbook.Sheets("Home")
Dim LR As Long
Dim table2 As ListObject
LR = Sheets("Home").Range("E" & Rows.Count).End(xlUp).Row
Set table2 = sh.ListObjects("Table1356")
Dim lr2 As ListRow
Set lr2 = table2.ListRows.add
With lr2
.Range(2).Value = pos_form.pos_orderno.Value
.Range(3).Value = pos_form.pos_date.Value
.Range(4).Value = pos_form.pos_cmbx_name.Value
.Range(5).Value = pos_form.pos_category.Value
.Range(6).Value = pos_form.pos_quantity.Value
.Range(7).Value = pos_form.pos_price.Value
.Range(8).Value = pos_form.pos_customer.Value
.Range(9).Value = pos_form.pos_address.Value
.Range(10).Value = pos_form.pos_contact.Value
.Range(11).Value = pos_form.pos_other.Value
If pos_form.pos_cod.Value Then .Range(15).Value = "COD/CASH"
If pos_form.pos_gcash.Value Then .Range(15).Value = "G-CASH"
End With
pos_form.pos_orderno.Value = ""
pos_form.pos_date.Value = ""
pos_form.pos_cmbx_name = ""
pos_form.pos_category.Value = ""
pos_form.pos_quantity.Value = ""
pos_form.pos_price.Value = ""
pos_form.pos_customer.Value = ""
pos_form.pos_address.Value = ""
pos_form.pos_contact.Value = ""
pos_form.pos_other.Value = ""
pos_form.pos_cod.Value = False
pos_form.pos_gcash.Value = False
Worksheets("Home").Protect "Roshier"
Unload pos_form
Exit Sub
Else
MsgBox "Check the details carefully!"
End If
End Sub
This is the Entry Form
This is the Datasheet
and I also noticed some problem, in range(1), I have put some Conditional Formatting to put a color.. Delivered as grey, Pending as Red, For Delivery as Green.. But when I added some data in the queue, the color is malfunctioning? all data I put in: delivered, pending, for delivery, it appears to always color green. What happen? anyone who could help me? Thanks in Advance !