{"id":430,"date":"2025-01-13T02:33:34","date_gmt":"2025-01-12T17:33:34","guid":{"rendered":"https:\/\/hajidai.com\/excel\/2025\/01\/excel%e3%83%9e%e3%82%b9%e3%82%bf%e3%83%bc%e3%81%b8%e3%81%ae%e9%81%93-%e9%a9%9a%e7%95%b0%e3%81%ae%e6%99%82%e7%9f%ad%e3%82%92%e5%ae%9f%e7%8f%be%e3%81%99%e3%82%8b%e9%ab%98%e5%ba%a6%e3%82%af%e3%83%ad\/"},"modified":"2025-01-13T02:33:34","modified_gmt":"2025-01-12T17:33:34","slug":"excel%e3%83%9e%e3%82%b9%e3%82%bf%e3%83%bc%e3%81%b8%e3%81%ae%e9%81%93-%e9%a9%9a%e7%95%b0%e3%81%ae%e6%99%82%e7%9f%ad%e3%82%92%e5%ae%9f%e7%8f%be%e3%81%99%e3%82%8b%e9%ab%98%e5%ba%a6%e3%82%af%e3%83%ad","status":"publish","type":"post","link":"https:\/\/hajidai.com\/excel\/2025\/01\/excel%e3%83%9e%e3%82%b9%e3%82%bf%e3%83%bc%e3%81%b8%e3%81%ae%e9%81%93-%e9%a9%9a%e7%95%b0%e3%81%ae%e6%99%82%e7%9f%ad%e3%82%92%e5%ae%9f%e7%8f%be%e3%81%99%e3%82%8b%e9%ab%98%e5%ba%a6%e3%82%af%e3%83%ad\/","title":{"rendered":"Excel\u30de\u30b9\u30bf\u30fc\u3078\u306e\u9053: \u9a5a\u7570\u306e\u6642\u77ed\u3092\u5b9f\u73fe\u3059\u308b\u9ad8\u5ea6\u30af\u30ed\u30b9\u96c6\u8a08\u30de\u30af\u30ed\u6d3b\u7528\u8853"},"content":{"rendered":"<h2>\u30c7\u30fc\u30bf\u7d71\u5408\u306e\u65b0\u6b21\u5143\uff01\u4e0a\u7d1a\u8005\u304c\u6311\u6226\u3059\u308b\u9ad8\u5ea6\u306a\u30af\u30ed\u30b9\u96c6\u8a08\u30de\u30af\u30ed<\/h2>\n<p>\u4ee5\u4e0b\u306e\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u306f\u3001\u8907\u6570\u306e\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u304b\u3089\u30c7\u30fc\u30bf\u3092\u7d71\u5408\u3057\u3001\u30af\u30ed\u30b9\u96c6\u8a08\u3092\u884c\u3046\u9ad8\u5ea6\u306a\u6a5f\u80fd\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002Excel\u3092\u4f7f\u3044\u3053\u306a\u3057\u3066\u3082\u3063\u3068\u697d\u3092\u3057\u305f\u3044\u3001\u696d\u52d9\u3092\u52b9\u7387\u5316\u3057\u305f\u3044\u4e0a\u7d1a\u8005\u306e\u65b9\u3005\u306b\u305c\u3072\u8a66\u3057\u3066\u3044\u305f\u3060\u304d\u305f\u3044\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n<p>&#8220;`vba<br \/>\nSub AdvancedCrossTabulation()<br \/>\n    Dim ws As Worksheet<br \/>\n    Dim lastRow As Long, lastCol As Long<br \/>\n    Dim i As Long, j As Long<br \/>\n    Dim dataRange As Range<br \/>\n    Dim pivotCache As PivotCache<br \/>\n    Dim pivotTable As PivotTable<\/p>\n<p>    &#8216; \u65b0\u3057\u3044\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u3092\u4f5c\u6210<br \/>\n    Set ws = ThisWorkbook.Sheets.Add<br \/>\n    ws.Name = &#8220;\u7d71\u5408\u30c7\u30fc\u30bf&#8221;<\/p>\n<p>    &#8216; \u5168\u30b7\u30fc\u30c8\u306e\u30c7\u30fc\u30bf\u3092\u7d71\u5408<br \/>\n    For Each sheet In ThisWorkbook.Worksheets<br \/>\n        If sheet.Name <> ws.Name Then<br \/>\n            lastRow = sheet.Cells(sheet.Rows.Count, &#8220;A&#8221;).End(xlUp).Row<br \/>\n            lastCol = sheet.Cells(1, sheet.Columns.Count).End(xlToLeft).Column<br \/>\n            sheet.Range(sheet.Cells(1, 1), sheet.Cells(lastRow, lastCol)).Copy _<br \/>\n                ws.Cells(ws.Cells(ws.Rows.Count, &#8220;A&#8221;).End(xlUp).Row + 1, 1)<br \/>\n        End If<br \/>\n    Next sheet<\/p>\n<p>    &#8216; \u30d4\u30dc\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u306e\u4f5c\u6210<br \/>\n    lastRow = ws.Cells(ws.Rows.Count, &#8220;A&#8221;).End(xlUp).Row<br \/>\n    lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column<br \/>\n    Set dataRange = ws.Range(ws.Cells(1, 1), ws.Cells(lastRow, lastCol))<\/p>\n<p>    Set pivotCache = ThisWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=dataRange)<br \/>\n    Set pivotTable = pivotCache.CreatePivotTable(TableDestination:=ws.Cells(lastRow + 2, 1), TableName:=&#8221;\u30af\u30ed\u30b9\u96c6\u8a08&#8221;)<\/p>\n<p>    &#8216; \u30d4\u30dc\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u8a2d\u5b9a\uff08\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u304c\u5fc5\u8981\uff09<br \/>\n    With pivotTable<br \/>\n        .PivotFields(&#8220;\u5217A&#8221;).Orientation = xlRowField<br \/>\n        .PivotFields(&#8220;\u5217B&#8221;).Orientation = xlColumnField<br \/>\n        .PivotFields(&#8220;\u5217C&#8221;).Orientation = xlDataField<br \/>\n    End With<br \/>\nEnd Sub<br \/>\n&#8220;`<\/p>\n<h3>1. \u30c7\u30fc\u30bf\u7d71\u5408\u306e\u81ea\u52d5\u5316<\/h3>\n<p>Excel \u30de\u30af\u30ed\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u8907\u6570\u306e\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306b\u6563\u5728\u3059\u308b\u30c7\u30fc\u30bf\u3092\u81ea\u52d5\u7684\u306b1\u3064\u306e\u30b7\u30fc\u30c8\u306b\u7d71\u5408\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u624b\u4f5c\u696d\u3067\u306e\u30b3\u30d4\u30fc&#038;\u30da\u30fc\u30b9\u30c8\u306b\u3088\u308b\u30df\u30b9\u3092\u9632\u304e\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u52b9\u7387\u7684\u306b\u51e6\u7406\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002\u4e0a\u8a18\u306e\u30de\u30af\u30ed\u3067\u306f\u3001For Each \u30eb\u30fc\u30d7\u3092\u4f7f\u7528\u3057\u3066\u5168\u30b7\u30fc\u30c8\u3092\u8d70\u67fb\u3057\u3001\u30c7\u30fc\u30bf\u3092\u65b0\u3057\u3044\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306b\u30b3\u30d4\u30fc\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>2. \u30d4\u30dc\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u306e\u81ea\u52d5\u4f5c\u6210<\/h3>\n<p>\u7d71\u5408\u3055\u308c\u305f\u30c7\u30fc\u30bf\u304b\u3089\u3001\u30de\u30af\u30ed\u3092\u4f7f\u7528\u3057\u3066\u30d4\u30dc\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u3092\u81ea\u52d5\u7684\u306b\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u30d4\u30dc\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u306f\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u7d20\u65e9\u304f\u5206\u6790\u3057\u3001\u3055\u307e\u3056\u307e\u306a\u89d2\u5ea6\u304b\u3089\u96c6\u8a08\u3092\u884c\u3046\u305f\u3081\u306e\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3067\u3059\u3002\u30de\u30af\u30ed\u3067\u306f\u3001PivotCache \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068 PivotTable \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f7f\u7528\u3057\u3066\u3001\u30d4\u30dc\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u624b\u52d5\u3067\u30d4\u30dc\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3059\u308b\u624b\u9593\u3092\u5927\u5e45\u306b\u524a\u6e1b\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>3. \u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u6027\u3068\u67d4\u8edf\u6027<\/h3>\n<p>\u63d0\u793a\u3057\u305f\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u306f\u3001\u57fa\u672c\u7684\u306a\u69cb\u9020\u3092\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u5b9f\u969b\u306e\u696d\u52d9\u30cb\u30fc\u30ba\u306b\u5408\u308f\u305b\u3066\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002\u4f8b\u3048\u3070\u3001\u30d4\u30dc\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u8a2d\u5b9a\u3092\u5909\u66f4\u3057\u305f\u308a\u3001\u7279\u5b9a\u306e\u6761\u4ef6\u306b\u57fa\u3065\u3044\u3066\u30c7\u30fc\u30bf\u3092\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u307e\u305f\u3001\u30a8\u30e9\u30fc\u51e6\u7406\u3092\u8ffd\u52a0\u3057\u305f\u308a\u3001\u30e6\u30fc\u30b6\u30fc\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u6539\u5584\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u5805\u7262\u3067\u4f7f\u3044\u3084\u3059\u3044\u30de\u30af\u30ed\u306b\u767a\u5c55\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>Excel \u30de\u30af\u30ed\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u7d71\u5408\u3068\u30af\u30ed\u30b9\u96c6\u8a08\u306e\u4f5c\u696d\u3092\u5927\u5e45\u306b\u52b9\u7387\u5316\u3057\u3001\u3088\u308a\u9ad8\u5ea6\u306a\u5206\u6790\u3092\u77ed\u6642\u9593\u3067\u884c\u3046\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u30de\u30af\u30ed\u306e\u4f7f\u7528\u306b\u306f\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a\u3092\u9069\u5207\u306b\u7ba1\u7406\u3057\u3001\u4fe1\u983c\u3067\u304d\u308b\u30bd\u30fc\u30b9\u304b\u3089\u306e\u30de\u30af\u30ed\u306e\u307f\u3092\u5b9f\u884c\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002\u307e\u305f\u3001\u91cd\u8981\u306a\u30c7\u30fc\u30bf\u3092\u6271\u3046\u969b\u306f\u3001\u4e8b\u524d\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u53d6\u308b\u3053\u3068\u3092\u5fd8\u308c\u305a\u306b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30c7\u30fc\u30bf\u7d71\u5408\u306e\u65b0\u6b21\u5143\uff01\u4e0a\u7d1a\u8005\u304c\u6311\u6226\u3059\u308b\u9ad8\u5ea6\u306a\u30af\u30ed\u30b9\u96c6\u8a08\u30de\u30af\u30ed \u4ee5\u4e0b\u306e\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u306f\u3001\u8907\u6570\u306e\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u304b\u3089\u30c7\u30fc\u30bf\u3092\u7d71\u5408\u3057\u3001\u30af\u30ed\u30b9\u96c6\u8a08\u3092\u884c\u3046\u9ad8\u5ea6\u306a\u6a5f\u80fd\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002Excel\u3092\u4f7f\u3044\u3053\u306a\u3057\u3066\u3082\u3063\u3068\u697d\u3092\u3057\u305f\u3044\u3001\u696d\u52d9\u3092\u52b9\u7387\u5316\u3057\u305f\u3044<\/p>\n","protected":false},"author":2,"featured_media":429,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-430","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-advanced"],"_links":{"self":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts\/430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/comments?post=430"}],"version-history":[{"count":0,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts\/430\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media\/429"}],"wp:attachment":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media?parent=430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/categories?post=430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/tags?post=430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}