MO-KAN SHO
New Member
- Joined
- Apr 11, 2005
- Messages
- 49
#1, I'm not experienced in VBA, so what code I do have is basically written by modifying code found on this forum. That's how I got this far.
#2, I can't find out why I'm getting a runtime error 13 'type mismatch' error when running this code. From what I'm deciphering from the how much of the code is running first the error must be due to one of the lines marked with asterisks. But I don't know how to fix it.
I am not getting the message box with the PO number in the last line of code, however, 1 line immediately after the asterisks is being completed with no problem.
Any help is greatly appreciated....
Thanks!
Ben
#2, I can't find out why I'm getting a runtime error 13 'type mismatch' error when running this code. From what I'm deciphering from the how much of the code is running first the error must be due to one of the lines marked with asterisks. But I don't know how to fix it.
Code:
Sub auto_open()
poneeded = MsgBox("Do you need a Purchase Order Number?", vbYesNo)
If poneeded = vbNo Then
Exit Sub
End If
If poneeded = vbYes Then
Application.ScreenUpdating = False
Range("B65536").End(xlUp).Offset(1, 0).Select
Application.ScreenUpdating = True
Dim strVendor As String
Dim strTech As String
Dim strReason As String
Dim strAssigner As String
Dim po As String
un = Environ("USERAME")
Do Until strVendor <> ""
strVendor = InputBox("Which Vendor?", "PO Information")
Loop
Do Until strTech <> ""
strTech = InputBox("Who's requesting this PO?", "PO Information")
Loop
Do Until strReason <> ""
strReason = InputBox("What customer or purpose is this PO for?", "PO Information")
Loop
ActiveCell.Offset(0, 0) = strVendor
ActiveCell.Offset(0, 1) = strTech
ActiveCell.Offset(0, 2) = strReason
'*******************************************************
ActiveCell.Offset(0, 3) = Date
ActiveCell.Offset(0, 4) = un
'*******************************************************
ActiveCell.Offset(0, -1) = ActiveCell.Offset(-1, -1).Value + 1
po = MsgBox("PO Number Assigned is: " And ActiveCell.Offset(0, -1).Value, vbokay)
ActiveCell.Offset(1, 0).Select
End If
End Sub
I am not getting the message box with the PO number in the last line of code, however, 1 line immediately after the asterisks is being completed with no problem.
Any help is greatly appreciated....
Thanks!
Ben