If Target.Column = 13 And Cells(trow, 13) = "" Then
On Error GoTo xit
Else
Dim code As String
Dim fnd As String
'Qualifer to check for Door frame
fnd = Cells(trow, 13)
fnd = InStr(fnd, "DF")
If fnd = 1 Then
fnd = Cells(trow, 13) 'extract the door frame code
fnd = Mid(fnd, 3, 1) 'extract the number
If fnd > 4 Then
MsgBox "Inproper Door Frame Code"
Cells(trow, 13) = ClearContents
Cells(trow, 13).Select
End If
'1doorframe sets, 1door, 2 door, 3door and 4 door
If Target.Column = 13 And Target = "DF" & fnd Then
OptimizeVBA True
'Left stile info
Cells(trow, 18) = Cells(trow, 10).Value 'OTY
Cells(trow, 19) = Cells(trow, 11).Value 'Height
Cells(trow, 20) = ls 'Stile width
code = "LHS-" & getU
Cells(trow, 21) = code
'right Stile info
Cells(trow, 22) = Cells(trow, 10).Value 'OTY
Cells(trow, 23) = Cells(trow, 11).Value 'Height
Cells(trow, 24) = rs 'Stile width
code = "RHS-" & getU
Cells(trow, 25) = code
'Top rail info
Cells(trow, 26) = Cells(trow, 10).Value 'OTY
Cells(trow, 27) = Cells(trow, 12).Value - (ls + rs) 'Width
Cells(trow, 28) = tr 'Stile width
code = "TR-" & getU
Cells(trow, 29) = code
'Bottom rail info
Cells(trow, 30) = Cells(trow, 10).Value 'OTY
Cells(trow, 31) = Cells(trow, 12).Value - (ls + rs) 'Width
Cells(trow, 32) = br 'Stile width
code = "BR-" & getU
Cells(trow, 33) = code
'Door info
Cells(trow, 34) = Cells(trow, 10).Value 'OTY
Cells(trow, 35) = Cells(trow, 11).Value - (tr + br) 'door height
Cells(trow, 36) = Cells(trow, 12).Value - (ls + rs) 'door width
code = "Do" & fnd & "-" & getU
Cells(trow, 37) = code
OptimizeVBA False
End If
End If
End If