WumboWunkus
New Member
- Joined
- Mar 18, 2024
- Messages
- 2
- Office Version
- 2021
- 2019
- Platform
- Windows
Hi all,
I am working on a module that is designed to allow my users to input values that the script formats and enters into the correct data entry positions. However, I am encountering an issue when a field does not apply and the user tries to hit "ok" to move on, and it ends the sub. I have tried a few different methods for getting past this issue but so far have had 0 success. I welcome any suggestions and thank you for your time in advance!
Here's the mod so far:
I am working on a module that is designed to allow my users to input values that the script formats and enters into the correct data entry positions. However, I am encountering an issue when a field does not apply and the user tries to hit "ok" to move on, and it ends the sub. I have tried a few different methods for getting past this issue but so far have had 0 success. I welcome any suggestions and thank you for your time in advance!
Here's the mod so far:
VBA Code:
Sub SCARentry()
' Dim Scar # to coman/internal:
Dim scarnum As Double, scardate As String, initiator As String, mednonmed As String, comanint As String
' Dim supplier to pdt code:
Dim supplier As String, suppcontname As String, suppcontemail As String, pdttype As String, pdtcode As String
'Dim pdt description to Vendor Response Date:
Dim pdtdesc As String, procagent As String, procagentcontact As String, vendresponsedate As String
'Dim Extension Request to cost per unit:
Dim extrequest As String, ponum As String, defectquant As Double, nonconfdetails As String, costunit As Double
'Dim Blue sheets to credit expected:
Dim bluesheets As String, casummary As String, materialdisposition As String, creditexpected As String
'Dim open or closed
Dim openclosed As String
Sheets("SCARs 2024").Select
Range("A1").Select
Range("A1").End(xlDown).Offset(1).Select
' Selects end row's first open cell, which contains scar number
scarnum = InputBox("Enter Scar Number:")
ActiveCell.Value = scarnum
ActiveCell.Offset(0, 1).Select
'Moves to next cell (date)
scardate = InputBox("Enter SCAR date:")
ActiveCell.Value = scardate
ActiveCell.Offset(0, 1).Select
' Moves to next cell, initiator
initiator = InputBox("Enter the name of the SCAR initiator:")
ActiveCell.Value = initiator
ActiveCell.Offset(0, 1).Select
'Moves to next cell, med/nonmed
mednonmed = InputBox("Medical or Nonmedical?")
ActiveCell.Value = mednonmed
ActiveCell.Offset(0, 1).Select
'Moves to next cell, coman/internal
comanint = InputBox("Coman or Internal?")
ActiveCell.Value = comanint
ActiveCell.Offset(0, 1).Select
' Next active cell, supplier name
supplier = InputBox("Enter the supplier (business) name:")
ActiveCell.Value = supplier
ActiveCell.Offset(0, 1).Select
' Supplier contact name cell
suppcontname = InputBox("Enter supplier contact/representative's name:")
ActiveCell.Value = suppcontname
ActiveCell.Offset(0, 1).Select
' Supplier contact email cell
suppcontemail = InputBox("Enter supplier contact email:")
ActiveCell.Value = suppcontemail
ActiveCell.Offset(0, 1).Select
' Product type
pdttype = InputBox("Enter product type (e.g., Packaging):")
ActiveCell.Value = pdttype
ActiveCell.Offset(0, 1).Select
' Product code
pdtcode = InputBox("Enter product code:")
ActiveCell.Value = pdtcode
ActiveCell.Offset(0, 1).Select
'Product description
pdtdesc = InputBox("Enter product description:")
ActiveCell.Value = pdtdesc
ActiveCell.Offset(0, 1).Select
' PBB MRA, Procurement Agent
procagent = InputBox("Enter the name(s) of the PBB MRA Procurement Agent:")
ActiveCell.Value = procagent
ActiveCell.Offset(0, 1).Select
'Procurement Agent Contact
procagentcontact = InputBox("Enter contact information for procurement agent:")
ActiveCell.Value = procagentcontact
ActiveCell.Offset(0, 1).Select
' Vendor Response Date
vendresponsedate = InputBox("Enter vendor response date:")
ActiveCell.Value = vendresponsedate
ActiveCell.Offset(0, 1).Select
' Extension request
extrequest = InputBox("Extension request? (date or N/A):")
ActiveCell.Value = extrequest
ActiveCell.Offset(0, 1).Select
'PO number
ponum = InputBox("Enter purchase order (PO) number:")
ActiveCell.Value = extrequest
ActiveCell.Offset(0, 1).Select
'Defective quantity
defectquant = InputBox("Enter the defective quantity (#s only):")
ActiveCell.Value = defectquant
ActiveCell.Offset(0, 1).Select
'Non-conformance details
nonconfdetails = InputBox("Enter the details of the non-conformance:")
ActiveCell.Value = nonconfdetails
ActiveCell.Offset(0, 1).Select
'Cost per unit
costunit = InputBox("Enter the cost per unit (e.g. 0.0412):")
ActiveCell.Value = costunit
ActiveCell.Offset(0, 1).Select
'Blue Sheets
bluesheets = InputBox("Enter Blue Sheets:")
ActiveCell.Value = bluesheets
ActiveCell.Offset(0, 2).Select
'Supplier Corrective Action Summary, skips over total cost (column calculated in sheet)
casummary = InputBox("Enter supplier corrective action summary:")
ActiveCell.Value = casummary
ActiveCell.Offset(0, 1).Select
' Material Disposition
materialdisposition = InputBox("Enter material disposition:")
ActiveCell.Value = materialdisposition
ActiveCell.Offset(0, 1).Select
'Credit expected (Yes/No)
creditexpected = InputBox("Is a credit expected (Yes/No)?:")
ActiveCell.Value = creditexpected
ActiveCell.Offset(0, 2).Select
'Open or closed
openclosed = InputBox("Open or Closed?")
ActiveCell.Value = openclosed
Sheets("Control Panel").Select
'Returns to control panel sheet for next steps
MsgBox ("Great! We're done. Remember to check the SCARs 2024 sheet to make sure all information is correct, and edit if needed.")
End Sub