2_入荷 最終行に登録ボタン

Sub 登録ボタン() '入荷済
Dim 行 As Long
Dim 列 As Long
Dim n As Long


'高速化開始
    With Application
        .Calculation = xlCalculationManual
        .EnableEvents = False
        .ScreenUpdating = False
    End With

Workbooks.Open FileName:="D:\JBRC検収システム\03_入力済データ\入荷済.xlsm"
n = Cells(Rows.Count, "B").End(xlUp).Row + 1

With Workbooks("入荷済.xlsm").Worksheets("入荷済")

    .Range("B" & n) = UserForm1.TextBox11.Value     '送り状No
    .Range("C" & n) = UserForm1.TextBox1.Value  '入荷日
    .Range("D" & n) = UserForm1.TextBox13.Value 'カーゴNo
    .Range("E" & n) = UserForm1.TextBox12.Value 'UNo
    .Range("F" & n) = UserForm1.TextBox3.Value '便
    .Range("G" & n) = UserForm1.TextBox8.Value '口数
    .Range("H" & n) = UserForm1.TextBox9.Value '件数
    .Range("I" & n) = UserForm1.TextBox4.Value '個数
    .Range("J" & n) = UserForm1.TextBox14.Value '拠点No
    .Range("K" & n) = UserForm1.TextBox5.Value '拠点名
    .Range("L" & n) = UserForm1.TextBox15.Value 'カーゴ集計No
    .Range("M" & n) = UserForm1.Label21.Caption 'カーゴ大口
    .Range("N" & n) = UserForm1.TextBox7.Value '荷姿
    .Range("O" & n) = UserForm1.TextBox6.Value 'G/W
'    MsgBox UserForm1.TextBox11.Text

    If UserForm1.TextBox4.Text <> UserForm1.TextBox8.Text Then
    .Range("P" & n) = UserForm1.TextBox4.Value '間違い個数
    .Range("I" & n) = UserForm1.TextBox4.Value  '実個数変更
End With

End If

Workbooks("入荷済.xlsm").Close savechanges:=True

'テキストをクリアにする
'MsgBox "登録しました。"
'高速化終了
    With Application
        .Calculation = xlCalculationAutomatic
        .EnableEvents = True
        .ScreenUpdating = True
    End With    
End Sub