Try to find worksheet by partial match
This commit is contained in:
@@ -38,7 +38,19 @@ Sub FillFromKukanMaster(ByVal ws As Worksheet, ByVal rowNum As Long, Optional By
|
||||
Dim code As String
|
||||
|
||||
On Error Resume Next
|
||||
Set wsKukan = ThisWorkbook.Worksheets("区間メンテナンス")
|
||||
' Try to find worksheet with partial match
|
||||
Dim wsName As String
|
||||
wsName = "区間メンテナンス"
|
||||
Set wsKukan = Nothing
|
||||
Dim s As Worksheet
|
||||
For Each s In ThisWorkbook.Worksheets
|
||||
If InStr(1, s.Name, "区間", vbTextCompare) > 0 Then
|
||||
Set wsKukan = s
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If wsKukan Is Nothing Then Set wsKukan = ThisWorkbook.Worksheets(wsName)
|
||||
|
||||
If wsKukan Is Nothing Then
|
||||
Dim wsList As String
|
||||
Dim s As Worksheet
|
||||
|
||||
Reference in New Issue
Block a user