I am at my wits end as to why my code listed below isn't working. The only field that will update when I click my Save button is txtVenue. Every other field resets to the prior value when this code runs. Any ideas? I have a headache from trying to figure this one out.
Thanks in advance,
Scott
Private Sub cmdSave_Click()
Application.ScreenUpdating = False
Sheets("Items").Visible = True
Worksheets("Items").Select
FinalRow = Cells(Rows.Count, "A").End(xlUp).Row
Set iItem = Range("A1:A" & FinalRow)
Set iVenue = Range("A1:A" & FinalRow)
Set iCategory = Range("B1:B" & FinalRow)
Set iDescription = Range("C1:C" & FinalRow)
Set iCaseType = Range("D1:D" & FinalRow)
Set iCaseCount = Range("E1:E" & FinalRow)
Set iCasePrice = Range("F1:F" & FinalRow)
Set iRetailPrice = Range("G1:G" & FinalRow)
Set iInt = Range("H1:H" & FinalRow)
Set iIntCount = Range("I1:I" & FinalRow)
Set iNS = Range("J1:J" & FinalRow)
If txtVenue.Value = "" Then GoTo Blank
If cboCategory.Value = "" Then GoTo Blank
If txtDescription.Value = "" Then GoTo Blank
If cboCountBy.Value = "" Then GoTo Blank
If txtCaseCount.Value = "" Then GoTo Blank
If txtCasePrice.Value = "" Then GoTo Blank
If txtRetailPrice.Value = "" Then GoTo Blank
If chkInterior.Value = True And txtInteriorCount.Value = "" Then GoTo Blank
For i = 2 To FinalRow
If iItem(i).Value = lstItems.Value Then
iVenue(i).Value = txtVenue.Value
iCategory(i).Value = cboCategory.Value
iDescription(i).Value = txtDescription.Value
iCaseType(i).Value = cboCountBy.Value
iCaseCount(i).Value = txtCaseCount.Value
iCasePrice(i).Value = txtCasePrice.Value
iRetailPrice(i).Value = txtRetailPrice.Value
iInt(i).Value = chkInterior.Value
iIntCount(i).Value = txtInteriorCount.Value
iNS(i).Value = chkNS.Value
End If
Next
Columns("A:J").Sort Key1:=Range("B2"), Order1:=xlAscending _
, Key2:=Range("A2"), Order2:=xlAscending, Header:=xlYes
GoTo Last
Blank:
ItemList.Hide
MsgBox "Error. All fields must be completely filled in.", vbCritical, _
"Missing Fields"
ItemList.Show
Last:
Sheets("Items").Visible = False
Worksheets("Control").Select
Application.ScreenUpdating = True
End Sub
Bookmarks