{"id":202,"date":"2024-11-22T17:43:24","date_gmt":"2024-11-22T08:43:24","guid":{"rendered":"https:\/\/anbtksh.com\/?p=202"},"modified":"2024-11-23T17:36:30","modified_gmt":"2024-11-23T08:36:30","slug":"%e4%bf%ae%e6%ad%a3%e4%b8%ad","status":"publish","type":"post","link":"https:\/\/anbtksh.com\/?p=202","title":{"rendered":"\u30b7\u30a7\u30a4\u30d7\u304b\u3089\u5185\u5bb9\u78ba\u8a8d\u306e\u4e00\u89a7\u8868\u3092\u51fa\u529b"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Sub \u30b7\u30a7\u30a4\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u4e00\u89a7A()<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Application.ScreenUpdating = False<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Dim folderPath As String<br>Dim fileName As String<br>Dim targetWb As Workbook<br>Dim resultWb As Workbook<br>Dim resultWs As Worksheet<br>Dim row As Long<br>Dim resultFilePath As String<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9\u3092\u53d6\u5f97<br>folderPath = InputBox(&#8220;\u64cd\u4f5c\u5bfe\u8c61\u306b\u306a\u308b\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044&#8221;, &#8220;\u30d5\u30a9\u30eb\u30c0\u306e\u9078\u629e&#8221;)<br>If Right(folderPath, 1) &lt;&gt; &#8220;\\&#8221; Then folderPath = folderPath &amp; &#8220;\\&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u7d50\u679c\u3092\u51fa\u529b\u3059\u308b\u65b0\u3057\u3044\u30d6\u30c3\u30af\u3092\u4f5c\u6210<br>Set resultWb = Workbooks.Add<br>Set resultWs = resultWb.sheets(1)<br>resultWs.Name = &#8220;\u30b7\u30a7\u30a4\u30d7\u306e\u4e00\u89a7&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u898b\u51fa\u3057\u3092\u8a2d\u5b9a<br>resultWs.Cells(1, 1).Value = &#8220;\u30d6\u30c3\u30af\u540d&#8221;<br>resultWs.Cells(1, 2).Value = &#8220;\u30b7\u30fc\u30c8\u540d&#8221;<br>resultWs.Cells(1, 3).Value = &#8220;\u30b0\u30eb\u30fc\u30d7\u540d&#8221;<br>resultWs.Cells(1, 4).Value = &#8220;\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u540d&#8221;<br>resultWs.Cells(1, 5).Value = &#8220;\u30c6\u30ad\u30b9\u30c8&#8221;<br>resultWs.Cells(1, 6).Value = &#8220;TBL&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u898b\u51fa\u3057\u306e\u66f8\u5f0f\u8a2d\u5b9a<br>With resultWs.Range(&#8220;A1:F1&#8221;)<br>.Interior.Color = RGB(255, 255, 0) &#8216; \u80cc\u666f\u3092\u9ec4\u8272\u306b\u8a2d\u5b9a<br>.HorizontalAlignment = xlCenter &#8216; \u30bb\u30f3\u30bf\u30ea\u30f3\u30b0<br>.Font.Bold = True<br>End With<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; 1\u884c\u76ee\u3092\u56fa\u5b9a<br>resultWs.rows(&#8220;2:2&#8221;).Select<br>ActiveWindow.FreezePanes = True<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">row = 2<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u30d5\u30a9\u30eb\u30c0\u5185\u306e\u3059\u3079\u3066\u306eExcel\u30d5\u30a1\u30a4\u30eb\u3092\u30eb\u30fc\u30d7<br>fileName = Dir(folderPath &amp; &#8220;<em>.xls<\/em>&#8220;)<br>Do While fileName &lt;&gt; &#8220;&#8221;<br>Set targetWb = Workbooks.Open(folderPath &amp; fileName)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>' \u5404\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u3092\u30eb\u30fc\u30d7\nDim ws As Worksheet\nFor Each ws In targetWb.Worksheets\n    ' \u5404\u30b7\u30a7\u30a4\u30d7\u3092\u30eb\u30fc\u30d7\n    Dim targetShape As shape\n    For Each targetShape In ws.Shapes\n        Call \u30b7\u30a7\u30a4\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u4e00\u89a7A_1(targetShape, resultWs, row, \"\", ws.Name, targetWb.Name)\n    Next targetShape\nNext ws\n\ntargetWb.Close False\nfileName = Dir<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Loop<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u30bb\u30eb\u5e45\u3092\u6700\u9069\u5316<br>resultWs.columns(&#8220;A:F&#8221;).AutoFit<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; E\u5217\u306e\u30c6\u30ad\u30b9\u30c8\u3092\u5927\u6587\u5b57\u306b\u5909\u63db<br>Dim lastRow As Long<br>lastRow = resultWs.Cells(resultWs.rows.Count, &#8220;E&#8221;).End(xlUp).row<br>Dim i As Long<br>For i = 2 To lastRow<br>resultWs.Cells(i, 5).Value = UCase(resultWs.Cells(i, 5).Value)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>' (TBL_ \u3092\u542b\u3080\u30c6\u30ad\u30b9\u30c8\u3092\u62bd\u51fa\u3057\u3066F\u5217\u306b\u66f8\u304d\u51fa\u3059\nDim text As String\ntext = resultWs.Cells(i, 5).Value\nIf InStr(text, \"(TBL_\") &gt; 0 Then\n    Dim startPos As Long\n    Dim endPos As Long\n    startPos = InStr(text, \"(TBL_\")\n    endPos = InStr(startPos, text, \")\")\n    If endPos &gt; startPos Then\n        resultWs.Cells(i, 6).Value = Mid(text, startPos + 1, endPos - startPos - 1)\n    End If\nEnd If<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next i<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u7d50\u679c\u30d6\u30c3\u30af\u3092\u6307\u5b9a\u3055\u308c\u305f\u30d5\u30a9\u30eb\u30c0\u306b\u4fdd\u5b58<br>resultFilePath = folderPath &amp; &#8220;\u30b7\u30a7\u30a4\u30d7\u306e\u4e00\u89a7\u7d50\u679c.xlsx&#8221;<br>resultWb.SaveAs resultFilePath<br>resultWb.Close False<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Application.ScreenUpdating = True<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">End Sub<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sub \u30b7\u30a7\u30a4\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u4e00\u89a7A_1(targetShape As shape, resultWs As Worksheet, ByRef row As Long, groupName As String, sheetName As String, bookName As String)<br>Dim i As Long<br>Dim shapeName As String<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">shapeName = targetShape.Name<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u30b0\u30eb\u30fc\u30d7\u5316\u3055\u308c\u305f\u30b7\u30a7\u30a4\u30d7\u306e\u5834\u5408<br>If targetShape.Type = msoGroup Then<br>For i = 1 To targetShape.GroupItems.Count<br>Call \u30b7\u30a7\u30a4\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u4e00\u89a7A_1(targetShape.GroupItems(i), resultWs, row, shapeName, sheetName, bookName)<br>Next i<br>Else<br>&#8216; \u30c6\u30ad\u30b9\u30c8\u304c\u3042\u308b\u5834\u5408<br>If targetShape.TextFrame2.HasText Then<br>resultWs.Cells(row, 1).Value = bookName<br>resultWs.Cells(row, 2).Value = sheetName<br>resultWs.Cells(row, 3).Value = groupName<br>resultWs.Cells(row, 4).Value = shapeName<br>resultWs.Cells(row, 5).Value = targetShape.TextFrame2.textRange.text<br>row = row + 1<br>End If<br>End If<br>End Sub<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sub \u7d50\u679c\u306e\u78ba\u8a8d\u3068\u767b\u9332()<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Application.ScreenUpdating = False<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Dim ws As Worksheet<br>Dim ws2 As Worksheet<br>Dim ws3 As Worksheet<br>Dim lastRow As Long<br>Dim lastRow2 As Long<br>Dim lastRow3 As Long<br>Dim i As Long, j As Long<br>Dim bookName As String, sheetName As String, groupName As String<br>Dim filePath As String<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u30d5\u30eb\u30d1\u30b9\u3092\u5165\u529b<br>filePath = InputBox(&#8220;\u5bfe\u8c61\u306e\u30b7\u30fc\u30c8\u306e\u30d5\u30eb\u30d1\u30b9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044:&#8221;)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u30ef\u30fc\u30af\u30d6\u30c3\u30af\u3092\u958b\u304f<br>On Error Resume Next<br>Set ws = Workbooks.Open(filePath).sheets(&#8220;\u30b7\u30a7\u30a4\u30d7\u306e\u4e00\u89a7&#8221;)<br>On Error GoTo 0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If ws Is Nothing Then<br>MsgBox &#8220;\u6307\u5b9a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u3051\u307e\u305b\u3093\u3067\u3057\u305f\u3002&#8221;<br>Exit Sub<br>End If<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; G\u5217\u306e\u30bf\u30a4\u30c8\u30eb\u306b\u300c\u524a\u9664\u300d\u3068\u5165\u529b<br>ws.Cells(1, &#8220;G&#8221;).Value = &#8220;\u524a\u9664&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; H\u5217\u306e\u30bf\u30a4\u30c8\u30eb\u306b\u300c\u4e3b\u30ad\u30fc\u300d\u3068\u5165\u529b<br>ws.Cells(1, &#8220;H&#8221;).Value = &#8220;\u4e3b\u30ad\u30fc&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; I\u5217\u306e\u30bf\u30a4\u30c8\u30eb\u306b\u300c\u306a\u3057\u300d\u3068\u5165\u529b<br>ws.Cells(1, &#8220;I&#8221;).Value = &#8220;\u306a\u3057&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; J\u5217\u306e\u30bf\u30a4\u30c8\u30eb\u306b\u300c\u8ad6\u7406DB\u300d\u3068\u5165\u529b<br>ws.Cells(1, &#8220;J&#8221;).Value = &#8220;\u8ad6\u7406DB&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u6700\u7d42\u884c\u3092\u53d6\u5f97<br>lastRow = ws.Cells(ws.rows.Count, &#8220;E&#8221;).End(xlUp).row<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; E\u5217\u3092\u5927\u6587\u5b57\u306b\u5909\u63db\u3057\u3001\u30c8\u30ea\u30e0\u3057\u3066\u6539\u884c\u3084\u7a7a\u767d\u3092\u524a\u9664<br>For i = 2 To lastRow<br>ws.Cells(i, &#8220;E&#8221;).Value = Trim(UCase(Replace(ws.Cells(i, &#8220;E&#8221;).Value, vbLf, &#8220;&#8221;)))<br>Next i<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; F\u5217\u3092\u30eb\u30fc\u30d7\u3057\u3066\u300cTBL_XX\u300d\u3092\u542b\u3080\u884c\u3092\u63a2\u3059<br>For i = 2 To lastRow<br>If InStr(ws.Cells(i, &#8220;F&#8221;).Value, &#8220;TBL_XX&#8221;) &gt; 0 Then<br>bookName = ws.Cells(i, &#8220;A&#8221;).Value<br>sheetName = ws.Cells(i, &#8220;B&#8221;).Value<br>groupName = ws.Cells(i, &#8220;C&#8221;).Value<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    For j = 2 To lastRow\n        If ws.Cells(j, \"A\").Value = bookName And _\n           ws.Cells(j, \"B\").Value = sheetName And _\n           ws.Cells(j, \"C\").Value = groupName Then\n            ws.Cells(j, \"G\").Value = 1\n        End If\n    Next j\nEnd If<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next i<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; E\u5217\u3092\u30eb\u30fc\u30d7\u3057\u3066\u300c\u25cf\u300d\u3067\u59cb\u307e\u308b\u884c\u3092\u63a2\u3059<br>For i = 2 To lastRow<br>If Left(ws.Cells(i, &#8220;E&#8221;).Value, 1) = &#8220;\u25cf&#8221; Then<br>ws.Cells(i, &#8220;H&#8221;).Value = 1<br>End If<br>Next i<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; E\u5217\u3092\u30eb\u30fc\u30d7\u3057\u3066\u300c\u306a\u3057\u300d\u3092\u542b\u3080\u884c\u3092\u63a2\u3059<br>For i = 2 To lastRow<br>If InStr(ws.Cells(i, &#8220;E&#8221;).Value, &#8220;\u306a\u3057&#8221;) &gt; 0 Then<br>ws.Cells(i, &#8220;I&#8221;).Value = 1<br>End If<br>Next i<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; G\u5217\u3001H\u5217\u3001I\u5217\u3001F\u5217\u304c\u3059\u3079\u3066\u7a7a\u767d\u306e\u884c\u306eF\u5217\u306b0\u3092\u767b\u9332<br>For i = 2 To lastRow<br>If IsEmpty(ws.Cells(i, &#8220;G&#8221;)) And IsEmpty(ws.Cells(i, &#8220;H&#8221;)) And IsEmpty(ws.Cells(i, &#8220;I&#8221;)) And IsEmpty(ws.Cells(i, &#8220;F&#8221;)) Then<br>ws.Cells(i, &#8220;F&#8221;).Value = 0<br>End If<br>Next i<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; A\u5217\u3001B\u5217\u3001C\u5217\u3001F\u5217\u3092\u6607\u9806\u3067\u30bd\u30fc\u30c8<br>ws.Sort.SortFields.Clear<br>ws.Sort.SortFields.Add Key:=ws.Range(&#8220;A2:A&#8221; &amp; lastRow), Order:=xlAscending<br>ws.Sort.SortFields.Add Key:=ws.Range(&#8220;B2:B&#8221; &amp; lastRow), Order:=xlAscending<br>ws.Sort.SortFields.Add Key:=ws.Range(&#8220;C2:C&#8221; &amp; lastRow), Order:=xlAscending<br>ws.Sort.SortFields.Add Key:=ws.Range(&#8220;F2:F&#8221; &amp; lastRow), Order:=xlAscending<br>With ws.Sort<br>.SetRange ws.Range(&#8220;A1:J&#8221; &amp; lastRow)<br>.Header = xlYes<br>.MatchCase = False<br>.Orientation = xlTopToBottom<br>.SortMethod = xlPinYin<br>.Apply<br>End With<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; F\u5217\u306b0\u304c\u3042\u308b\u884c\u306eE\u5217\u306e\u5185\u5bb9\u3092J\u5217\u306b\u8a18\u5165<br>For i = 2 To lastRow<br>If ws.Cells(i, &#8220;F&#8221;).Value = 0 And Not IsEmpty(ws.Cells(i, &#8220;F&#8221;)) Then<br>ws.Cells(i, &#8220;J&#8221;).Value = ws.Cells(i, &#8220;E&#8221;).Value<br>End If<br>Next i<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; 1\u884c\u76ee\u306e\u30bf\u30a4\u30c8\u30eb\u3092\u30bb\u30f3\u30bf\u30ea\u30f3\u30b0\u3001\u80cc\u666f\u3092\u9ec4\u8272\u306b\u3057\u3001\u56fa\u5b9a\u3057\u3066\u30d5\u30a3\u30eb\u30bf\u3092\u304b\u3051\u308b<br>With ws.rows(1)<br>.HorizontalAlignment = xlCenter<br>.Interior.Color = RGB(255, 255, 0)<br>End With<br>ws.rows(2).Select<br>ActiveWindow.FreezePanes = True<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u30d5\u30a3\u30eb\u30bf\u304c\u304b\u304b\u3063\u3066\u3044\u306a\u3044\u5834\u5408\u306b\u30d5\u30a3\u30eb\u30bf\u3092\u304b\u3051\u308b<br>If Not ws.AutoFilterMode Then<br>ws.rows(1).AutoFilter<br>End If<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u5217\u5e45\u3092\u6700\u9069\u5316<br>ws.columns(&#8220;A:J&#8221;).AutoFit<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u65b0\u3057\u3044\u30b7\u30fc\u30c8\u3092\u4f5c\u6210\u3057\u3066\u30c7\u30fc\u30bf\u3092\u30b3\u30d4\u30fc<br>Set ws2 = ws.Parent.sheets.Add(After:=ws.Parent.sheets(ws.Parent.sheets.Count))<br>ws2.Name = &#8220;\u30b7\u30a7\u30a4\u30d7\u306e\u4e00\u89a72&#8221;<br>ws.rows.Copy Destination:=ws2.rows<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; G\u5217\u3001H\u5217\u3001I\u5217\u306b1\u304c\u3042\u308b\u884c\u3092\u524a\u9664<br>For i = lastRow To 2 Step -1<br>If ws2.Cells(i, &#8220;G&#8221;).Value = 1 Or ws2.Cells(i, &#8220;H&#8221;).Value = 1 Or ws2.Cells(i, &#8220;I&#8221;).Value = 1 Then<br>ws2.rows(i).Delete<br>End If<br>Next i<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u5217\u5e45\u3092\u6700\u9069\u5316<br>For i = 1 To ws2.columns.Count<br>ws2.columns(i).AutoFit<br>Next i<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; F\u5217\u306b\u8a18\u5165\u304c\u3042\u308a\u3001J\u5217\u304c\u7a7a\u767d\u306e\u90e8\u5206\u306f\u4e0a\u306e\u884c\u306e\u5185\u5bb9\u3092\u30b3\u30d4\u30fc\u3057\u3066\u8a18\u5165<br>For i = 2 To lastRow<br>If Not IsEmpty(ws2.Cells(i, &#8220;F&#8221;)) And IsEmpty(ws2.Cells(i, &#8220;J&#8221;)) Then<br>ws2.Cells(i, &#8220;J&#8221;).Value = ws2.Cells(i &#8211; 1, &#8220;J&#8221;).Value<br>End If<br>Next i<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; K\u5217\u306e\u30bf\u30a4\u30c8\u30eb\u3092\u8a2d\u5b9a<br>ws2.Cells(1, &#8220;K&#8221;).Value = &#8220;\u30b5\u30d6\u30b7\u30b9\u30c6\u30e0\u540d&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; A\u5217\u306e\u5185\u5bb9\u3067\u534a\u89d2\u304a\u3088\u3073\u5168\u89d2\u306e\uff08\u3068\uff09\u3067\u56f2\u307e\u308c\u3066\u3044\u308b\u5185\u5bb9\u3092K\u5217\u306b\u8a18\u5165<br>For i = 2 To lastRow<br>If InStr(ws2.Cells(i, &#8220;A&#8221;).Value, &#8220;(&#8220;) &gt; 0 And InStr(ws2.Cells(i, &#8220;A&#8221;).Value, &#8220;)&#8221;) &gt; 0 Then<br>ws2.Cells(i, &#8220;K&#8221;).Value = Mid(ws2.Cells(i, &#8220;A&#8221;).Value, InStr(ws2.Cells(i, &#8220;A&#8221;).Value, &#8220;(&#8220;) + 1, InStr(ws2.Cells(i, &#8220;A&#8221;).Value, &#8220;)&#8221;) &#8211; InStr(ws2.Cells(i, &#8220;A&#8221;).Value, &#8220;(&#8220;) &#8211; 1)<br>ElseIf InStr(ws2.Cells(i, &#8220;A&#8221;).Value, &#8220;\uff08&#8221;) &gt; 0 And InStr(ws2.Cells(i, &#8220;A&#8221;).Value, &#8220;\uff09&#8221;) &gt; 0 Then<br>ws2.Cells(i, &#8220;K&#8221;).Value = Mid(ws2.Cells(i, &#8220;A&#8221;).Value, InStr(ws2.Cells(i, &#8220;A&#8221;).Value, &#8220;\uff08&#8221;) + 1, InStr(ws2.Cells(i, &#8220;A&#8221;).Value, &#8220;\uff09&#8221;) &#8211; InStr(ws2.Cells(i, &#8220;A&#8221;).Value, &#8220;\uff08&#8221;) &#8211; 1)<br>End If<br>Next i<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u30ef\u30fc\u30af\u30d6\u30c3\u30af\u3092\u4fdd\u5b58\uff08\u9589\u3058\u306a\u3044\uff09<br>ws.Parent.Save<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u30b7\u30fc\u30c8\u3092\u8a2d\u5b9a<br>Set ws3 = ws.Parent.sheets.Add(After:=ws2)<br>ws3.Name = &#8220;\u30b7\u30a7\u30a4\u30d7\u306e\u4e00\u89a73&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u6700\u7d42\u884c\u3092\u53d6\u5f97<br>lastRow2 = ws2.Cells(ws2.rows.Count, &#8220;F&#8221;).End(xlUp).row<br>lastRow3 = ws3.Cells(ws3.rows.Count, &#8220;A&#8221;).End(xlUp).row + 1<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; F\u5217\u304c0\u3067\u306a\u3044\u3082\u306e\u3092\u30b3\u30d4\u30fc<br>j = lastRow3<br>For i = 2 To lastRow2<br>If ws2.Cells(i, &#8220;F&#8221;).Value &lt;&gt; 0 Then<br>ws3.Cells(j, &#8220;A&#8221;).Value = ws2.Cells(i, &#8220;F&#8221;).Value<br>ws3.Cells(j, &#8220;B&#8221;).Value = ws2.Cells(i, &#8220;K&#8221;).Value<br>ws3.Cells(j, &#8220;C&#8221;).Value = ws2.Cells(i, &#8220;J&#8221;).Value<br>j = j + 1<br>End If<br>Next i<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; A1\u304b\u3089C1\u306e\u30bb\u30eb\u3092\u9078\u629e<br>With ws3.Range(&#8220;A1:C1&#8221;)<br>&#8216; \u80cc\u666f\u8272\u3092\u9ec4\u8272\u306b\u8a2d\u5b9a<br>.Interior.Color = RGB(255, 255, 0)<br>&#8216; \u30bb\u30f3\u30bf\u30ea\u30f3\u30b0<br>.HorizontalAlignment = xlCenter<br>&#8216; \u30d5\u30a3\u30eb\u30bf\u306e\u8ffd\u52a0<br>.AutoFilter<br>End With<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; A\u5217\u306e\u30bf\u30a4\u30c8\u30eb\u306b\u300cTBL\u300d\u3068\u5165\u529b<br>ws3.Cells(1, &#8220;A&#8221;).Value = &#8220;TBL&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; B\u5217\u306e\u30bf\u30a4\u30c8\u30eb\u306b\u300c\u30b5\u30d6\u30b7\u30b9\u30c6\u30e0\u300d\u3068\u5165\u529b<br>ws3.Cells(1, &#8220;B&#8221;).Value = &#8220;\u30b5\u30d6\u30b7\u30b9\u30c6\u30e0&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; C\u5217\u306e\u30bf\u30a4\u30c8\u30eb\u306b\u300c\u8ad6\u7406DB\u300d\u3068\u5165\u529b<br>ws3.Cells(1, &#8220;C&#8221;).Value = &#8220;\u8ad6\u7406DB&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; 2\u884c\u76ee\u3092\u9078\u629e\u3057\u3066\u56fa\u5b9a<br>ws3.rows(&#8220;2:2&#8221;).Select<br>ActiveWindow.FreezePanes = True<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8216; \u5217\u5e45\u3092\u6700\u9069\u5316<br>ws3.columns(&#8220;A:C&#8221;).AutoFit<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Application.ScreenUpdating = True<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Application.WindowState = xlMaximized<br>ActiveWindow.Zoom = 100<br>Range(&#8220;a1&#8221;).Select<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">End Sub<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sub test()<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Call \u30b7\u30a7\u30a4\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u4e00\u89a7A<br>Call \u7d50\u679c\u306e\u78ba\u8a8d\u3068\u767b\u9332<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">End Sub<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sub \u30b7\u30a7\u30a4\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u4e00\u89a7A() Application.ScreenUpdating = False Dim folderPath As StringDim fileName As StringDim target &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/anbtksh.com\/?p=202\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u30b7\u30a7\u30a4\u30d7\u304b\u3089\u5185\u5bb9\u78ba\u8a8d\u306e\u4e00\u89a7\u8868\u3092\u51fa\u529b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-202","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/posts\/202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/anbtksh.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=202"}],"version-history":[{"count":7,"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/posts\/202\/revisions"}],"predecessor-version":[{"id":210,"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/posts\/202\/revisions\/210"}],"wp:attachment":[{"href":"https:\/\/anbtksh.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anbtksh.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anbtksh.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}