i need to somehow modify the following code that the data does not unload until the user has selected yes from the msgbox.
as it currently is the data is transfered from my userform to the spreadsheet then asks if i want to finalize the sale, but regardless of whether i select yes or no the data has already been processed.
Private Sub cmdok_Click()
If Left(TxtSellingPrice.Value, 1) = "£" Then
Sales.TxtSellingPrice.Value = Right(TxtSellingPrice, Len(TxtSellingPrice) - 1)
End If
ActiveWorkbook.Sheets("Sales").Activate
Range("A6").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txtDate.Value
ActiveCell.Offset(0, 1) = cboBranch.Value
ActiveCell.Offset(0, 2) = cboPrefix.Value
ActiveCell.Offset(0, 3) = TxtName.Value
ActiveCell.Offset(0, 4) = CboManufact.Value
ActiveCell.Offset(0, 5) = CboEdition.Value
ActiveCell.Offset(0, 6) = TxtSellingPrice.Value
Range("A6").Select
If MsgBox("Are you sure you want to Finalize This Sale?", vbYesNoCancel + vbCritical) = vbYes Then
Unload Me
End If
End Sub
cheers
Andy
as it currently is the data is transfered from my userform to the spreadsheet then asks if i want to finalize the sale, but regardless of whether i select yes or no the data has already been processed.
Private Sub cmdok_Click()
If Left(TxtSellingPrice.Value, 1) = "£" Then
Sales.TxtSellingPrice.Value = Right(TxtSellingPrice, Len(TxtSellingPrice) - 1)
End If
ActiveWorkbook.Sheets("Sales").Activate
Range("A6").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txtDate.Value
ActiveCell.Offset(0, 1) = cboBranch.Value
ActiveCell.Offset(0, 2) = cboPrefix.Value
ActiveCell.Offset(0, 3) = TxtName.Value
ActiveCell.Offset(0, 4) = CboManufact.Value
ActiveCell.Offset(0, 5) = CboEdition.Value
ActiveCell.Offset(0, 6) = TxtSellingPrice.Value
Range("A6").Select
If MsgBox("Are you sure you want to Finalize This Sale?", vbYesNoCancel + vbCritical) = vbYes Then
Unload Me
End If
End Sub
cheers
Andy