Add debug and error handling for C column trigger

This commit is contained in:
updsv7
2026-04-13 12:00:56 +09:00
parent 65ad779d6d
commit 61f6f31fce

View File

@@ -38,6 +38,7 @@ Private Sub Worksheet_Change(ByVal Target As Range)
If Trim(Target.Value) = "" Then
Call ClearRowData(Me, Target.Row)
Else
MsgBox "C column changed: " & Trim(Target.Value), vbInformation
Call FillFromKukanMaster(Me, Target.Row)
End If
End If
@@ -244,10 +245,13 @@ Sub FillFromKukanMaster(ByVal ws As Worksheet, ByVal rowNum As Long, Optional By
Dim deValue As String
Dim fgValue As String
On Error Resume Next
On Error GoTo 0
Set wsKukan = ThisWorkbook.Worksheets("区間メンテナンス")
If wsKukan Is Nothing Then Exit Sub
If wsKukan Is Nothing Then
MsgBox "Worksheet '区間メンテナンス' not found.", vbExclamation
Exit Sub
End If
code = Trim(ws.Cells(rowNum, 3).Value)
If code = "" Then Exit Sub
@@ -276,8 +280,7 @@ Sub FillFromKukanMaster(ByVal ws As Worksheet, ByVal rowNum As Long, Optional By
Next
If Not found Then
Call ClearRowData(ws, rowNum)
Exit Sub
MsgBox "Code '" & code & "' not found in 区間メンテナンス.", vbExclamation
End If