diff --git a/XVBA/新版着工要因閲覧シート/vba-files/Module/Module1.bas b/XVBA/新版着工要因閲覧シート/vba-files/Module/Module1.bas index 82f1402c..94d0f3bd 100644 --- a/XVBA/新版着工要因閲覧シート/vba-files/Module/Module1.bas +++ b/XVBA/新版着工要因閲覧シート/vba-files/Module/Module1.bas @@ -306,12 +306,26 @@ End Function 'e[uŒTēǂݎAAPINGXgViewp[^ɓnDictionarygݗĂB 'Z̐Έʒuɂ͈ˑȂie[uړĂ삷jBee[u1=ږA2=l/~ƂB 'FilterESorterƂ0̏ꍇNothingԂiViewp[^̂t^Ȃ߁j +'ubN̑SV[g𑖍Aw肵OExcele[u(ListObject)TB‚ȂNothingԂ +Function FindListObjectByName(ByVal tblName As String) As ListObject + Dim sh As Worksheet + Dim tbl As ListObject + For Each sh In ThisWorkbook.Worksheets + On Error Resume Next + Set tbl = sh.ListObjects(tblName) + On Error GoTo 0 + If Not tbl Is Nothing Then + Set FindListObjectByName = tbl + Exit Function + End If + Next sh + Set FindListObjectByName = Nothing +End Function + Function BuildViewFromSheet() As Object Dim colFilter As New Dictionary Dim filterTbl As ListObject - On Error Resume Next - Set filterTbl = defaultSh.ListObjects("FilterTable") - On Error GoTo 0 + Set filterTbl = FindListObjectByName("FilterTable") If Not filterTbl Is Nothing Then If Not filterTbl.DataBodyRange Is Nothing Then @@ -328,9 +342,7 @@ Function BuildViewFromSheet() As Object Dim colSorter As New Dictionary Dim sorterTbl As ListObject - On Error Resume Next - Set sorterTbl = defaultSh.ListObjects("SorterTable") - On Error GoTo 0 + Set sorterTbl = FindListObjectByName("SorterTable") If Not sorterTbl Is Nothing Then If Not sorterTbl.DataBodyRange Is Nothing Then