Softedge
Board Regular
- Joined
- Dec 14, 2008
- Messages
- 144
I have been fighting this one for a couple of days.
Can anyone tell me why this inputbox would return an error if the JDE_WO is not the same as the PRO_WO? Both are text. The JDE_WO is extracted from another workbook, the PRO_WO is from the active workbook. I save the value of the range between selections. From the cell that is selected the routine uses the offset function to find the value of PRO_WO.
Regards,
Softedge
Can anyone tell me why this inputbox would return an error if the JDE_WO is not the same as the PRO_WO? Both are text. The JDE_WO is extracted from another workbook, the PRO_WO is from the active workbook. I save the value of the range between selections. From the cell that is selected the routine uses the offset function to find the value of PRO_WO.
Code:
Do While JDE_WO <> PRO_WO And Year(Datefrom) <> Year(Dateto) And _
Month(Datefrom) <> Month(Dateto) And isJDE <> "JDE" And Answer = "No"
Set copyto = Application.InputBox(Prompt:= _
"WO#: " & JDE_WO & " PO#: " & POfrom & vbCr & vbCr & _
"CONTRACTOR / HVC: " & Contfrom & vbCr & vbCr & _
"VALUE: " & "$" & Str(costfrom), _
Title:="Select AMOUNT Destination Cell:", _
Default:=toaddress, Left:=650, Top:=300, Type:=8)
With copyto
costto = costfrom
toaddress = .Address
rowto = .Row
colto = .Column
End With
Range(toaddress).Select
'Check that the WO numbers compare
PRO_WO = Range("E" & rowto).Offset(1, 0).Value
If PRO_WO <> JDE_WO Then
MsgBox "Work Order Number Mismatch" & vbCr & vbCr & "Select Cell with WO: " & JDE_WO
Else
'Check that a cell in the JDE column is selected
isJDE = Range(toaddress).Offset(4 - rowto, 0).Value
If isJDE <> "JDE" Then
MsgBox "Cell is not in the 'JDE' column:" & vbCr & vbCr & "Please try again."
Else
'Check that the right month and year column is selected
Dateto = Range(toaddress).Offset(3 - rowto, 0).Value
If Year(Datefrom) <> Year(Dateto) Or Month(Datefrom) <> Month(Dateto) Then
MsgBox "You are trying to update the wrong month." & vbCr & vbCr & "Please try the correct month."
Else
'Check that the value is being entered against the right PO
POto = Range("F" & rowto).Value
If POfrom <> POto Then
Response = MsgBox("PO Number MisMatch" & vbCr & vbCr & _
"Is the PO# Correct? - YES or NO", vbYesNo)
If Response = vbYes Then
Answer = "Yes"
Else
Answer = "No"
End If
Else
Answer = "Yes"
End If
End If
End If
End If
Loop
Softedge