{"id":412,"date":"2025-01-10T02:33:35","date_gmt":"2025-01-09T17:33:35","guid":{"rendered":"https:\/\/hajidai.com\/excel\/2025\/01\/%e3%80%8cexcel%e4%b8%8a%e7%b4%9a%e8%80%85%e5%bf%85%e8%a6%8b%ef%bc%81%e5%8b%95%e7%9a%84%e3%83%80%e3%83%83%e3%82%b7%e3%83%a5%e3%83%9c%e3%83%bc%e3%83%89%e8%87%aa%e5%8b%95%e7%94%9f%e6%88%90%e3%81%a7\/"},"modified":"2025-01-10T02:33:35","modified_gmt":"2025-01-09T17:33:35","slug":"%e3%80%8cexcel%e4%b8%8a%e7%b4%9a%e8%80%85%e5%bf%85%e8%a6%8b%ef%bc%81%e5%8b%95%e7%9a%84%e3%83%80%e3%83%83%e3%82%b7%e3%83%a5%e3%83%9c%e3%83%bc%e3%83%89%e8%87%aa%e5%8b%95%e7%94%9f%e6%88%90%e3%81%a7","status":"publish","type":"post","link":"https:\/\/hajidai.com\/excel\/2025\/01\/%e3%80%8cexcel%e4%b8%8a%e7%b4%9a%e8%80%85%e5%bf%85%e8%a6%8b%ef%bc%81%e5%8b%95%e7%9a%84%e3%83%80%e3%83%83%e3%82%b7%e3%83%a5%e3%83%9c%e3%83%bc%e3%83%89%e8%87%aa%e5%8b%95%e7%94%9f%e6%88%90%e3%81%a7\/","title":{"rendered":"\u300cExcel\u4e0a\u7d1a\u8005\u5fc5\u898b\uff01\u52d5\u7684\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u81ea\u52d5\u751f\u6210\u3067\u696d\u52d9\u52b9\u7387\u3092\u5287\u7684\u30a2\u30c3\u30d7\u300d"},"content":{"rendered":"<h2>Excel\u4e0a\u7d1a\u8005\u306e\u305f\u3081\u306e\u52d5\u7684\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u81ea\u52d5\u751f\u6210\u30c6\u30af\u30cb\u30c3\u30af<\/h2>\n<p>Excel\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\u306b\u3001\u3059\u3050\u306b\u8a66\u305b\u308b\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306eVBA\u30b3\u30fc\u30c9\u306f\u3001\u52d5\u7684\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e\u57fa\u672c\u7684\u306a\u67a0\u7d44\u307f\u3092\u81ea\u52d5\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>&#8220;`vba<br \/>\nSub CreateDynamicDashboard()<br \/>\n    Dim ws As Worksheet<br \/>\n    Set ws = ActiveSheet<\/p>\n<p>    &#8216; \u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e\u67a0\u7d44\u307f\u3092\u4f5c\u6210<br \/>\n    ws.Range(&#8220;A1:J1&#8221;).Merge<br \/>\n    ws.Range(&#8220;A1&#8221;).Value = &#8220;\u52d5\u7684\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9&#8221;<br \/>\n    ws.Range(&#8220;A1&#8221;).Font.Size = 16<br \/>\n    ws.Range(&#8220;A1&#8221;).Font.Bold = True<\/p>\n<p>    &#8216; \u30c7\u30fc\u30bf\u7bc4\u56f2\u3092\u5b9a\u7fa9<br \/>\n    ws.Range(&#8220;A3&#8221;).Value = &#8220;\u30c7\u30fc\u30bf\u7bc4\u56f2:&#8221;<br \/>\n    ws.Range(&#8220;B3&#8221;).Value = &#8220;=OFFSET($A$5,0,0,COUNTA($A$5:$A$1000),COUNTA($1:$1))&#8221;<\/p>\n<p>    &#8216; \u30d4\u30dc\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u306e\u4f5c\u6210<br \/>\n    Dim pvtCache As PivotCache<br \/>\n    Dim pvt As PivotTable<\/p>\n<p>    Set pvtCache = ThisWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=ws.Range(&#8220;B3&#8221;))<br \/>\n    Set pvt = pvtCache.CreatePivotTable(TableDestination:=ws.Range(&#8220;A10&#8243;), TableName:=&#8221;DynamicPivot&#8221;)<\/p>\n<p>    &#8216; \u30b0\u30e9\u30d5\u306e\u4f5c\u6210<br \/>\n    Dim cht As Chart<br \/>\n    Set cht = ws.Shapes.AddChart2(201, xlColumnClustered).Chart<br \/>\n    cht.SetSourceData Source:=pvt.TableRange1<\/p>\n<p>    MsgBox &#8220;\u52d5\u7684\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e\u57fa\u672c\u67a0\u7d44\u307f\u304c\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f\u3002&#8221;<br \/>\nEnd Sub<br \/>\n&#8220;`<\/p>\n<p>\u3053\u306e\u30de\u30af\u30ed\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u52d5\u7684\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e\u57fa\u672c\u7684\u306a\u69cb\u9020\u304c\u81ea\u52d5\u7684\u306b\u751f\u6210\u3055\u308c\u307e\u3059\u3002\u30c7\u30fc\u30bf\u7bc4\u56f2\u3001\u30d4\u30dc\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u3001\u30b0\u30e9\u30d5\u304c\u9023\u52d5\u3057\u3066\u4f5c\u6210\u3055\u308c\u3001\u5f8c\u306f\u30c7\u30fc\u30bf\u3092\u5165\u529b\u3059\u308b\u3060\u3051\u3067\u52d5\u7684\u306b\u66f4\u65b0\u3055\u308c\u308b\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u304c\u5b8c\u6210\u3057\u307e\u3059\u3002<\/p>\n<h3>1. \u30c7\u30fc\u30bf\u306e\u52d5\u7684\u53c2\u7167<\/h3>\n<p>\u52d5\u7684\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e\u6838\u5fc3\u306f\u3001\u30c7\u30fc\u30bf\u306e\u52d5\u7684\u53c2\u7167\u306b\u3042\u308a\u307e\u3059\u3002\u4e0a\u8a18\u306e\u30de\u30af\u30ed\u3067\u306f\u3001OFFSET\u95a2\u6570\u3068COUNTA\u95a2\u6570\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u52d5\u7684\u306a\u540d\u524d\u4ed8\u304d\u7bc4\u56f2\u3092\u5b9a\u7fa9\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30c7\u30fc\u30bf\u304c\u8ffd\u52a0or\u524a\u9664\u3055\u308c\u3066\u3082\u81ea\u52d5\u7684\u306b\u7bc4\u56f2\u304c\u8abf\u6574\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>Excel \u30de\u30af\u30ed\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u3053\u306e\u3088\u3046\u306a\u52d5\u7684\u53c2\u7167\u3092\u7c21\u5358\u306b\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002\u3055\u3089\u306b\u3001INDIRECT\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308c\u3070\u3001\u30bb\u30eb\u53c2\u7167\u3092\u6587\u5b57\u5217\u3068\u3057\u3066\u6271\u3044\u3001\u3088\u308a\u67d4\u8edf\u306a\u52d5\u7684\u53c2\u7167\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>2. \u30d4\u30dc\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u306e\u6d3b\u7528<\/h3>\n<p>\u52d5\u7684\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306b\u304a\u3044\u3066\u3001\u30d4\u30dc\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u306f\u975e\u5e38\u306b\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3067\u3059\u3002\u30de\u30af\u30ed\u3092\u4f7f\u7528\u3057\u3066\u30d4\u30dc\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u3001\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3092\u52d5\u7684\u7bc4\u56f2\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u5e38\u306b\u6700\u65b0\u306e\u30c7\u30fc\u30bf\u304c\u53cd\u6620\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3055\u3089\u306b\u3001\u30b9\u30e9\u30a4\u30b5\u30fc\u3084\u30bf\u30a4\u30e0\u30e9\u30a4\u30f3\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u76f4\u611f\u7684\u306b\u30c7\u30fc\u30bf\u3092\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u6a5f\u80fd\u3082VBA\u3092\u4f7f\u7528\u3057\u3066\u81ea\u52d5\u7684\u306b\u8ffd\u52a0\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>3. \u30b0\u30e9\u30d5\u306e\u81ea\u52d5\u66f4\u65b0<\/h3>\n<p>\u52d5\u7684\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e\u8996\u899a\u7684\u306a\u8981\u7d20\u3068\u3057\u3066\u3001\u30b0\u30e9\u30d5\u306f\u6b20\u304b\u305b\u307e\u305b\u3093\u3002\u30de\u30af\u30ed\u3092\u4f7f\u7528\u3057\u3066\u30b0\u30e9\u30d5\u3092\u4f5c\u6210\u3057\u3001\u30d4\u30dc\u30c3\u30c8\u30c6\u30fc\u30d6\u30eb\u3068\u30ea\u30f3\u30af\u3055\u305b\u308b\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u306e\u5909\u66f4\u306b\u5fdc\u3058\u3066\u81ea\u52d5\u7684\u306b\u66f4\u65b0\u3055\u308c\u308b\u30b0\u30e9\u30d5\u304c\u5b8c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u30b0\u30e9\u30d5\u306e\u7a2e\u985e\u3084\u66f8\u5f0f\u8a2d\u5b9a\u3082\u3001VBA\u3092\u4f7f\u7528\u3057\u3066\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u3092\u9069\u7528\u3057\u3066\u3001\u7279\u5b9a\u306e\u6761\u4ef6\u4e0b\u3067\u30b0\u30e9\u30d5\u306e\u8272\u304c\u5909\u308f\u308b\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u3089\u306e\u30c6\u30af\u30cb\u30c3\u30af\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001Excel\u4e0a\u7d1a\u8005\u306f\u5f37\u529b\u306a\u52d5\u7684\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3092\u81ea\u52d5\u751f\u6210\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u30de\u30af\u30ed\u306e\u4f7f\u7528\u306b\u306f\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u4e0a\u306e\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002\u4fe1\u983c\u3067\u304d\u308b\u30bd\u30fc\u30b9\u304b\u3089\u306e\u30de\u30af\u30ed\u306e\u307f\u3092\u5b9f\u884c\u3057\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u30de\u30af\u30ed\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a\u3092\u8abf\u6574\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u52d5\u7684\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e\u81ea\u52d5\u751f\u6210\u306f\u3001\u30c7\u30fc\u30bf\u5206\u6790\u3084\u5831\u544a\u66f8\u4f5c\u6210\u306e\u52b9\u7387\u3092\u5927\u5e45\u306b\u5411\u4e0a\u3055\u305b\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u30c6\u30af\u30cb\u30c3\u30af\u3092\u7fd2\u5f97\u3057\u3001\u5b9f\u8df5\u3059\u308b\u3053\u3068\u3067\u3001Excel\u306e\u3055\u3089\u306a\u308b\u53ef\u80fd\u6027\u3092\u5f15\u304d\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Excel\u4e0a\u7d1a\u8005\u306e\u305f\u3081\u306e\u52d5\u7684\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u81ea\u52d5\u751f\u6210\u30c6\u30af\u30cb\u30c3\u30af Excel\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\u306b\u3001\u3059\u3050\u306b\u8a66\u305b\u308b\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306eVBA\u30b3\u30fc\u30c9\u306f\u3001\u52d5\u7684\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306e\u57fa<\/p>\n","protected":false},"author":2,"featured_media":411,"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-412","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\/412","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=412"}],"version-history":[{"count":0,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts\/412\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media\/411"}],"wp:attachment":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media?parent=412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/categories?post=412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/tags?post=412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}