Hello,
The following code is something I've been trying to get to work for a couple of hours now.
I'm not that great at VBA scripting as I've just been teaching myself over the last couple of weeks.
Any help with this would be apreciated.
The problem is that the code I've made to extract the value for "BATCH / SERIAL" that corrosponds to the "PO" from another spreadsheet (which uses =indirect() forumlae so I have to open another spreadsheet too) doesn't work It just doesn't find the value even though it's in there.
SETUP:
Worksheets("CONC DESCRIPTION").Select
Cells.Select
Selection.ClearContents
DIMENSION_VARIABLES:
Dim INPUT_VAR As Variant
Dim RESPONSE As Variant
SET_PO:
INPUT_VAR = 0
INPUT_VAR = Application.InputBox("INSERT PO", "PO")
If INPUT_VAR = False Then
GoTo EXIT_SUB
Else
If INPUT_VAR = "" Then
MsgBox ("IS NOTHING")
GoTo SET_PO
Else
If Len(INPUT_VAR) = 9 Then
If IsNumeric(INPUT_VAR) And Val(INPUT_VAR) > 0 Then
Else
MsgBox ("NONNUMERIAL OR NOT >0")
GoTo SET_PO
End If
Else
MsgBox ("LEN =/= 9")
GoTo SET_PO
End If
End If
End If
ADD_PO:
RESPONSE = MsgBox("PO: " & INPUT_VAR & " - CORRECT?", vbYesNo)
If RESPONSE = vbNo Then
MsgBox ("TRY AGAIN.")
GoTo SET_PO
Else
Application.Cells(12, 1) = "PO"
Application.Cells(12, 2) = INPUT_VAR
End If
SET_SERIAL_OR_BATCH:
Application.Cells(13, 1) = "SERIAL/BATCH"
Dim SERIALVPO As Workbook
Dim SPARTRACK As Workbook
Set SPARTRACK = Workbooks.Open("X:\A350XWB Manufacturing\General\5020 Concessions\Concession Status\Copy of A350 Rear Spar Serial Number log.xls", True, True)
Set SERIALVPO = Workbooks.Open("X:\A350XWB Manufacturing\General\5020 Concessions\Concession Status\SERIAL V PO.xls", True, True)
RESPONSE = Application.Match(INPUT_VAR, SERIALVPO.Worksheets("SERIAL V PO").Range("E1").EntireColumn, False)
If (Not RESPONSE Is Nothing) Then
Application.Cells(12, 2) = SERIALVPO.Worksheets("SERIAL V PO").Range("D" & RESPONSE).Value
Else
MsgBox ("SERIAL / BATCH NOT FOUND")
SERIALVPO.Close False
SPARTRACK.Close False
Set SERIALVPO = Nothing
Set SPARTRACK = Nothing
GoTo SET_PO
End If
SERIALVPO.Close False
SPARTRACK.Close False
Set SERIALVPO = Nothing
Set SPARTRACK = Nothing
Cheers.
Hutchay
Bookmarks