Fix error handling order in FillFromKukanMaster

This commit is contained in:
updsv7
2026-04-13 12:25:24 +09:00
parent 8ef6b52785
commit 30e2b8e5c3

View File

@@ -39,8 +39,6 @@ Sub FillFromKukanMaster(ByVal ws As Worksheet, ByVal rowNum As Long, Optional By
On Error Resume Next
Set wsKukan = ThisWorkbook.Worksheets("区間メンテナンス")
On Error GoTo 0
If wsKukan Is Nothing Then
Dim wsList As String
Dim s As Worksheet
@@ -50,6 +48,7 @@ Sub FillFromKukanMaster(ByVal ws As Worksheet, ByVal rowNum As Long, Optional By
MsgBox "Worksheet '区間メンテナンス' not found." & vbCrLf & vbCrLf & "Available sheets:" & vbCrLf & wsList, vbExclamation
Exit Sub
End If
On Error GoTo 0
code = Trim(ws.Cells(rowNum, 3).Value)
If code = "" Then Exit Sub
lastRow = wsKukan.Cells(wsKukan.Rows.Count, 3).End(xlUp).Row