{"id":307,"date":"2024-12-24T08:33:34","date_gmt":"2024-12-23T23:33:34","guid":{"rendered":"https:\/\/hajidai.com\/excel\/2024\/12\/excel%e3%83%9e%e3%82%af%e3%83%ad%e3%81%a7%e5%ae%9f%e7%8f%be%ef%bc%81%e7%9e%ac%e6%99%82%e3%81%ab%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e5%8f%af%e8%a6%96%e5%8c%96%e3%81%99%e3%82%8b%e9%ab%98%e5%ba%a6\/"},"modified":"2024-12-24T08:33:34","modified_gmt":"2024-12-23T23:33:34","slug":"excel%e3%83%9e%e3%82%af%e3%83%ad%e3%81%a7%e5%ae%9f%e7%8f%be%ef%bc%81%e7%9e%ac%e6%99%82%e3%81%ab%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e5%8f%af%e8%a6%96%e5%8c%96%e3%81%99%e3%82%8b%e9%ab%98%e5%ba%a6","status":"publish","type":"post","link":"https:\/\/hajidai.com\/excel\/2024\/12\/excel%e3%83%9e%e3%82%af%e3%83%ad%e3%81%a7%e5%ae%9f%e7%8f%be%ef%bc%81%e7%9e%ac%e6%99%82%e3%81%ab%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e5%8f%af%e8%a6%96%e5%8c%96%e3%81%99%e3%82%8b%e9%ab%98%e5%ba%a6\/","title":{"rendered":"Excel\u30de\u30af\u30ed\u3067\u5b9f\u73fe\uff01\u77ac\u6642\u306b\u30c7\u30fc\u30bf\u3092\u53ef\u8996\u5316\u3059\u308b\u9ad8\u5ea6\u30b0\u30e9\u30d5\u81ea\u52d5\u751f\u6210\u30c6\u30af\u30cb\u30c3\u30af"},"content":{"rendered":"<h2>\u30c7\u30fc\u30bf\u53ef\u8996\u5316\u306e\u9769\u547d\uff01\u4e0a\u7d1a\u8005\u304c\u6311\u6226\u3059\u308b\u9ad8\u5ea6\u306a\u30b0\u30e9\u30d5\u81ea\u52d5\u751f\u6210\u30de\u30af\u30ed<\/h2>\n<p>\u4ee5\u4e0b\u306f\u3001Excel\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\u4eba\u304c\u3059\u3050\u306b\u8a66\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u3067\u3059\uff1a<\/p>\n<p>&#8220;`vba<br \/>\nSub \u81ea\u52d5\u30b0\u30e9\u30d5\u751f\u6210()<br \/>\n    Dim ws As Worksheet<br \/>\n    Dim chartObj As ChartObject<br \/>\n    Dim lastRow As Long, lastCol As Long<\/p>\n<p>    Set ws = ActiveSheet<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<\/p>\n<p>    Set chartObj = ws.ChartObjects.Add(Left:=100, Width:=375, Top:=75, Height:=225)<\/p>\n<p>    With chartObj.Chart<br \/>\n        .SetSourceData Source:=ws.Range(ws.Cells(1, 1), ws.Cells(lastRow, lastCol))<br \/>\n        .ChartType = xlColumnClustered<br \/>\n        .HasTitle = True<br \/>\n        .ChartTitle.Text = &#8220;\u81ea\u52d5\u751f\u6210\u30b0\u30e9\u30d5&#8221;<br \/>\n    End With<br \/>\nEnd Sub<br \/>\n&#8220;`<\/p>\n<h3>1. Excel \u30de\u30af\u30ed\u306b\u3088\u308b\u30c7\u30fc\u30bf\u53ef\u8996\u5316\u306e\u9769\u65b0<\/h3>\n<p>Excel \u30de\u30af\u30ed\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u53ef\u8996\u5316\u306e\u30d7\u30ed\u30bb\u30b9\u3092\u5927\u5e45\u306b\u52b9\u7387\u5316\u3067\u304d\u307e\u3059\u3002\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u306f\u3001\u30b7\u30fc\u30c8\u4e0a\u306e\u30c7\u30fc\u30bf\u3092\u81ea\u52d5\u7684\u306b\u691c\u51fa\u3057\u3001\u305d\u308c\u306b\u57fa\u3065\u3044\u3066\u68d2\u30b0\u30e9\u30d5\u3092\u751f\u6210\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u624b\u52d5\u3067\u306e\u30b0\u30e9\u30d5\u4f5c\u6210\u306b\u304b\u304b\u308b\u6642\u9593\u3068\u52b4\u529b\u3092\u524a\u6e1b\u3057\u3001\u3088\u308a\u591a\u304f\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u8fc5\u901f\u306b\u8996\u899a\u5316\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>Excel \u30de\u30af\u30ed\u306e\u771f\u306e\u5a01\u529b\u306f\u3001\u53cd\u5fa9\u7684\u306a\u30bf\u30b9\u30af\u3092\u81ea\u52d5\u5316\u3059\u308b\u80fd\u529b\u306b\u3042\u308a\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u8907\u6570\u306e\u30b7\u30fc\u30c8\u3084\u7570\u306a\u308b\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306b\u5bfe\u3057\u3066\u540c\u3058\u30b0\u30e9\u30d5\u3092\u4f5c\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u3001\u30de\u30af\u30ed\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u4e00\u5ea6\u306e\u30af\u30ea\u30c3\u30af\u3067\u3059\u3079\u3066\u306e\u30b0\u30e9\u30d5\u3092\u751f\u6210\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306f\u7279\u306b\u5927\u898f\u6a21\u306a\u30c7\u30fc\u30bf\u5206\u6790\u3084\u5b9a\u671f\u7684\u306a\u30ec\u30dd\u30fc\u30c8\u4f5c\u6210\u306b\u304a\u3044\u3066\u975e\u5e38\u306b\u6709\u7528\u3067\u3059\u3002<\/p>\n<h3>2. \u9ad8\u5ea6\u306a\u30b0\u30e9\u30d5\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306e\u81ea\u52d5\u5316<\/h3>\n<p>\u4e0a\u7d1a\u8005\u5411\u3051\u306eExcel \u30de\u30af\u30ed\u3067\u306f\u3001\u5358\u7d14\u306a\u30b0\u30e9\u30d5\u751f\u6210\u306b\u3068\u3069\u307e\u3089\u305a\u3001\u9ad8\u5ea6\u306a\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3082\u81ea\u52d5\u5316\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u7279\u5b9a\u306e\u6761\u4ef6\u306b\u57fa\u3065\u3044\u3066\u30c7\u30fc\u30bf\u30dd\u30a4\u30f3\u30c8\u306e\u8272\u3092\u5909\u66f4\u3057\u305f\u308a\u3001\u30c8\u30ec\u30f3\u30c9\u30e9\u30a4\u30f3\u3092\u8ffd\u52a0\u3057\u305f\u308a\u3001\u3055\u3089\u306b\u306f\u8907\u6570\u306e\u30b0\u30e9\u30d5\u30bf\u30a4\u30d7\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u8907\u5408\u30b0\u30e9\u30d5\u3092\u4f5c\u6210\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306f\u3001\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u30dd\u30a4\u30f3\u30c8\u306e\u8272\u3092\u52d5\u7684\u306b\u5909\u66f4\u3059\u308b\u30de\u30af\u30ed\u306e\u4e00\u90e8\u3067\u3059\uff1a<\/p>\n<p>&#8220;`vba<br \/>\nFor Each pt In .SeriesCollection(1).Points<br \/>\n    If pt.Value < 0 Then\n        pt.Format.Fill.Color.RGB = RGB(255, 0, 0) ' \u8d64\u8272\n    ElseIf pt.Value > 100 Then<br \/>\n        pt.Format.Fill.Color.RGB = RGB(0, 255, 0) &#8216; \u7dd1\u8272<br \/>\n    End If<br \/>\nNext pt<br \/>\n&#8220;`<\/p>\n<p>\u3053\u306e\u3088\u3046\u306a\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3092\u624b\u52d5\u3067\u884c\u3046\u3068\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3059\u304c\u3001Excel \u30de\u30af\u30ed\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u8907\u96d1\u306a\u30b0\u30e9\u30d5\u3067\u3082\u77ac\u6642\u306b\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>3. \u30c7\u30fc\u30bf\u99c6\u52d5\u578b\u306e\u30b0\u30e9\u30d5\u751f\u6210\u30d7\u30ed\u30bb\u30b9<\/h3>\n<p>\u9ad8\u5ea6\u306aExcel \u30de\u30af\u30ed\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u306e\u7279\u6027\u306b\u57fa\u3065\u3044\u3066\u6700\u9069\u306a\u30b0\u30e9\u30d5\u30bf\u30a4\u30d7\u3092\u81ea\u52d5\u7684\u306b\u9078\u629e\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002\u4f8b\u3048\u3070\u3001\u6642\u7cfb\u5217\u30c7\u30fc\u30bf\u306e\u5834\u5408\u306f\u6298\u308c\u7dda\u30b0\u30e9\u30d5\u3092\u3001\u30ab\u30c6\u30b4\u30ea\u5225\u30c7\u30fc\u30bf\u306e\u5834\u5408\u306f\u68d2\u30b0\u30e9\u30d5\u3092\u81ea\u52d5\u7684\u306b\u9078\u629e\u3059\u308b\u3088\u3046\u306a\u30ed\u30b8\u30c3\u30af\u3092\u7d44\u307f\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306f\u3001\u30c7\u30fc\u30bf\u306e\u6027\u8cea\u306b\u57fa\u3065\u3044\u3066\u30b0\u30e9\u30d5\u30bf\u30a4\u30d7\u3092\u6c7a\u5b9a\u3059\u308b\u30de\u30af\u30ed\u306e\u4e00\u90e8\u3067\u3059\uff1a<\/p>\n<p>&#8220;`vba<br \/>\nIf WorksheetFunction.CountA(ws.Range(&#8220;A:A&#8221;)) > WorksheetFunction.CountA(ws.Range(&#8220;1:1&#8221;)) Then<br \/>\n    .ChartType = xlLine &#8216; \u6642\u7cfb\u5217\u30c7\u30fc\u30bf\u306e\u5834\u5408<br \/>\nElse<br \/>\n    .ChartType = xlColumnClustered &#8216; \u30ab\u30c6\u30b4\u30ea\u30c7\u30fc\u30bf\u306e\u5834\u5408<br \/>\nEnd If<br \/>\n&#8220;`<\/p>\n<p>\u3053\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u99c6\u52d5\u578b\u306e\u30a2\u30d7\u30ed\u30fc\u30c1\u306b\u3088\u308a\u3001\u30c7\u30fc\u30bf\u306e\u7279\u6027\u3092\u6700\u3082\u52b9\u679c\u7684\u306b\u8868\u73fe\u3059\u308b\u30b0\u30e9\u30d5\u3092\u81ea\u52d5\u7684\u306b\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u30c7\u30fc\u30bf\u5206\u6790\u306e\u8cea\u3092\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>Excel \u30de\u30af\u30ed\u3092\u6d3b\u7528\u3057\u305f\u30b0\u30e9\u30d5\u81ea\u52d5\u751f\u6210\u306f\u3001\u30c7\u30fc\u30bf\u53ef\u8996\u5316\u306e\u30d7\u30ed\u30bb\u30b9\u3092\u9769\u65b0\u3057\u3001\u5206\u6790\u306e\u52b9\u7387\u3068\u8cea\u3092\u5927\u5e45\u306b\u5411\u4e0a\u3055\u305b\u308b\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3067\u3059\u3002\u4e0a\u7d1a\u8005\u306f\u3053\u308c\u3089\u306e\u30c6\u30af\u30cb\u30c3\u30af\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u6d1e\u5bdf\u529b\u306e\u3042\u308b\u3001\u30a4\u30f3\u30d1\u30af\u30c8\u306e\u3042\u308b\u30c7\u30fc\u30bf\u30d3\u30b8\u30e5\u30a2\u30e9\u30a4\u30bc\u30fc\u30b7\u30e7\u30f3\u3092\u8fc5\u901f\u306b\u4f5c\u6210\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30c7\u30fc\u30bf\u53ef\u8996\u5316\u306e\u9769\u547d\uff01\u4e0a\u7d1a\u8005\u304c\u6311\u6226\u3059\u308b\u9ad8\u5ea6\u306a\u30b0\u30e9\u30d5\u81ea\u52d5\u751f\u6210\u30de\u30af\u30ed \u4ee5\u4e0b\u306f\u3001Excel\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\u4eba\u304c\u3059\u3050\u306b\u8a66\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u3067\u3059\uff1a #8220;`vba Sub \u81ea\u52d5\u30b0\u30e9\u30d5<\/p>\n","protected":false},"author":2,"featured_media":306,"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-307","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\/307","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=307"}],"version-history":[{"count":0,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts\/307\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media\/306"}],"wp:attachment":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media?parent=307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/categories?post=307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/tags?post=307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}