Add debug to show available worksheets when not found

This commit is contained in:
updsv7
2026-04-13 12:23:51 +09:00
parent d3abff7421
commit 8ef6b52785

View File

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