{"id":575,"date":"2025-03-09T00:33:34","date_gmt":"2025-03-08T15:33:34","guid":{"rendered":"https:\/\/hajidai.com\/excel\/2025\/03\/excel-vba%e3%83%9e%e3%82%b9%e3%82%bf%e3%83%bc-%e3%81%b8%e3%81%ae%e9%81%93-%e4%b8%8a%e7%b4%9a%e8%80%85%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e3%83%87%e3%83%90%e3%83%83%e3%82%b0%ef%bc%86%e3%83%91\/"},"modified":"2025-03-09T00:33:34","modified_gmt":"2025-03-08T15:33:34","slug":"excel-vba%e3%83%9e%e3%82%b9%e3%82%bf%e3%83%bc-%e3%81%b8%e3%81%ae%e9%81%93-%e4%b8%8a%e7%b4%9a%e8%80%85%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e3%83%87%e3%83%90%e3%83%83%e3%82%b0%ef%bc%86%e3%83%91","status":"publish","type":"post","link":"https:\/\/hajidai.com\/excel\/2025\/03\/excel-vba%e3%83%9e%e3%82%b9%e3%82%bf%e3%83%bc-%e3%81%b8%e3%81%ae%e9%81%93-%e4%b8%8a%e7%b4%9a%e8%80%85%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e3%83%87%e3%83%90%e3%83%83%e3%82%b0%ef%bc%86%e3%83%91\/","title":{"rendered":"Excel VBA\u30de\u30b9\u30bf\u30fc \u3078\u306e\u9053: \u4e0a\u7d1a\u8005\u306e\u305f\u3081\u306e\u30c7\u30d0\u30c3\u30b0\uff06\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u30c6\u30af\u30cb\u30c3\u30af"},"content":{"rendered":"<h2>\u4e0a\u7d1a\u8005\u5411\u3051VBA\u30c7\u30d0\u30c3\u30b0\u30c6\u30af\u30cb\u30c3\u30af\u3068\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30d7\u30ed\u30d5\u30a1\u30a4\u30ea\u30f3\u30b0<\/h2>\n<h3>\u3059\u3050\u306b\u8a66\u305b\u308b\u30de\u30af\u30ed\u30b3\u30fc\u30c9<\/h3>\n<p>&#8220;`vba<br \/>\nSub HighlightDuplicates()<br \/>\n    Dim rng As Range<br \/>\n    Dim cell As Range<\/p>\n<p>    Set rng = Selection<br \/>\n    For Each cell In rng<br \/>\n        If WorksheetFunction.CountIf(rng, cell.Value) > 1 Then<br \/>\n            cell.Interior.Color = vbYellow<br \/>\n        End If<br \/>\n    Next cell<br \/>\nEnd Sub<br \/>\n&#8220;`<\/p>\n<p>\u3053\u306e\u30de\u30af\u30ed\u306f\u9078\u629e\u3057\u305f\u30bb\u30eb\u7bc4\u56f2\u5185\u306e\u91cd\u8907\u5024\u3092\u9ec4\u8272\u3067\u30cf\u30a4\u30e9\u30a4\u30c8\u3057\u307e\u3059\u3002Excel \u30de\u30af\u30ed\u3092\u6d3b\u7528\u3057\u3066\u3001\u30c7\u30fc\u30bf\u306e\u53ef\u8996\u5316\u3084\u5206\u6790\u3092\u52b9\u7387\u5316\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>1. \u9ad8\u5ea6\u306a\u30c7\u30d0\u30c3\u30b0\u30c6\u30af\u30cb\u30c3\u30af<\/h3>\n<p>VBA\u30c7\u30d0\u30c3\u30b0\u306e\u4e16\u754c\u3067\u306f\u3001\u5358\u306a\u308b\u30a8\u30e9\u30fc\u4fee\u6b63\u3092\u8d85\u3048\u305f\u6280\u8853\u304c\u6c42\u3081\u3089\u308c\u307e\u3059\u3002\u30a6\u30a9\u30c3\u30c1\u30a6\u30a3\u30f3\u30c9\u30a6\u3084\u30a4\u30df\u30c7\u30a3\u30a8\u30a4\u30c8\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u6d3b\u7528\u306f\u57fa\u672c\u3067\u3059\u304c\u3001\u3055\u3089\u306b\u4e00\u6b69\u9032\u3093\u3067\u3001\u6761\u4ef6\u4ed8\u304d\u30d6\u30ec\u30fc\u30af\u30dd\u30a4\u30f3\u30c8\u306e\u8a2d\u5b9a\u3084CallStack\u306e\u89e3\u6790\u304c\u91cd\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u7279\u5b9a\u306e\u6761\u4ef6\u4e0b\u3067\u306e\u307f\u767a\u751f\u3059\u308b\u30d0\u30b0\u3092\u8ffd\u8de1\u3059\u308b\u5834\u5408\u3001\u6761\u4ef6\u4ed8\u304d\u30d6\u30ec\u30fc\u30af\u30dd\u30a4\u30f3\u30c8\u304c\u975e\u5e38\u306b\u6709\u52b9\u3067\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u554f\u984c\u304c\u767a\u751f\u3059\u308b\u77ac\u9593\u3092\u6b63\u78ba\u306b\u6349\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u30c7\u30d0\u30c3\u30b0\u6642\u9593\u3092\u5927\u5e45\u306b\u77ed\u7e2e\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u8907\u96d1\u306a\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306e\u547c\u3073\u51fa\u3057\u95a2\u4fc2\u3092\u7406\u89e3\u3059\u308b\u305f\u3081\u306b\u306f\u3001CallStack\u306e\u614e\u91cd\u306a\u5206\u6790\u304c\u6b20\u304b\u305b\u307e\u305b\u3093\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30a8\u30e9\u30fc\u306e\u6839\u672c\u539f\u56e0\u3092\u3088\u308a\u65e9\u304f\u7279\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>Excel \u30de\u30af\u30ed\u306e\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u3053\u308c\u3089\u306e\u9ad8\u5ea6\u306a\u30c7\u30d0\u30c3\u30b0\u6280\u8853\u3092\u7fd2\u5f97\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u5805\u7262\u3067\u4fe1\u983c\u6027\u306e\u9ad8\u3044\u30b3\u30fc\u30c9\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>2. \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u306e\u79d8\u8a23<\/h3>\n<p>VBA\u30b3\u30fc\u30c9\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u306f\u3001\u5927\u898f\u6a21\u306a\u30c7\u30fc\u30bf\u51e6\u7406\u3084\u8907\u96d1\u306a\u8a08\u7b97\u3092\u884c\u3046\u4e0a\u7d1a\u8005\u306b\u3068\u3063\u3066\u91cd\u8981\u306a\u30b9\u30ad\u30eb\u3067\u3059\u3002\u3053\u3053\u3067\u306f\u3001\u3044\u304f\u3064\u304b\u306e\u91cd\u8981\u306a\u30dd\u30a4\u30f3\u30c8\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u3001\u30eb\u30fc\u30d7\u51e6\u7406\u306e\u6700\u9069\u5316\u304c\u6319\u3052\u3089\u308c\u307e\u3059\u3002\u7279\u306b\u5927\u91cf\u306e\u30bb\u30eb\u3092\u51e6\u7406\u3059\u308b\u5834\u5408\u3001For Each \u30eb\u30fc\u30d7\u3088\u308a\u3082 For&#8230;Next \u30eb\u30fc\u30d7\u306e\u65b9\u304c\u9ad8\u901f\u3067\u3059\u3002\u307e\u305f\u3001\u914d\u5217\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u3092\u30e1\u30e2\u30ea\u306b\u8aad\u307f\u8fbc\u3093\u3067\u304b\u3089\u51e6\u7406\u3092\u884c\u3046\u3053\u3068\u3067\u3001\u30bb\u30eb\u306e\u76f4\u63a5\u64cd\u4f5c\u3092\u6e1b\u3089\u3057\u3001\u51e6\u7406\u901f\u5ea6\u3092\u5927\u5e45\u306b\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306b\u3001Application.ScreenUpdating = False \u3084 Application.Calculation = xlCalculationManual \u306a\u3069\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u9069\u5207\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u4e0d\u8981\u306a\u753b\u9762\u66f4\u65b0\u3084\u8a08\u7b97\u3092\u6291\u5236\u3057\u3001\u5b9f\u884c\u901f\u5ea6\u3092\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3055\u3089\u306b\u3001Select \u3084 Activate \u30e1\u30bd\u30c3\u30c9\u306e\u4f7f\u7528\u3092\u6700\u5c0f\u9650\u306b\u6291\u3048\u308b\u3053\u3068\u3082\u91cd\u8981\u3067\u3059\u3002\u3053\u308c\u3089\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u51e6\u7406\u901f\u5ea6\u3092\u4f4e\u4e0b\u3055\u305b\u308b\u8981\u56e0\u3068\u306a\u308b\u305f\u3081\u3001\u53ef\u80fd\u306a\u9650\u308a\u76f4\u63a5\u30bb\u30eb\u3092\u53c2\u7167\u3059\u308b\u65b9\u6cd5\u3092\u63a1\u7528\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>Excel \u30de\u30af\u30ed\u306e\u6700\u9069\u5316\u306b\u3088\u308a\u3001\u5927\u898f\u6a21\u306a\u30c7\u30fc\u30bf\u51e6\u7406\u3084\u8907\u96d1\u306a\u81ea\u52d5\u5316\u30bf\u30b9\u30af\u3092\u3088\u308a\u52b9\u7387\u7684\u306b\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>3. \u30d7\u30ed\u30d5\u30a1\u30a4\u30ea\u30f3\u30b0\u30c4\u30fc\u30eb\u306e\u6d3b\u7528<\/h3>\n<p>VBA\u30b3\u30fc\u30c9\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u8a73\u7d30\u306b\u5206\u6790\u3059\u308b\u306b\u306f\u3001\u30d7\u30ed\u30d5\u30a1\u30a4\u30ea\u30f3\u30b0\u30c4\u30fc\u30eb\u306e\u6d3b\u7528\u304c\u4e0d\u53ef\u6b20\u3067\u3059\u3002Microsoft Visual Basic for Applications\uff08VBA\uff09\u306b\u306f\u7d44\u307f\u8fbc\u307f\u306e\u30d7\u30ed\u30d5\u30a1\u30a4\u30e9\u30fc\u304c\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u306e\u30c4\u30fc\u30eb\u3084\u30ab\u30b9\u30bf\u30e0\u30b3\u30fc\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30b3\u30fc\u30c9\u306e\u5b9f\u884c\u6642\u9593\u3084\u547c\u3073\u51fa\u3057\u983b\u5ea6\u3092\u6e2c\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u7c21\u5358\u306a\u30d7\u30ed\u30d5\u30a1\u30a4\u30ea\u30f3\u30b0\u30b3\u30fc\u30c9\u3092\u81ea\u4f5c\u3059\u308b\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002\u5404\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306e\u958b\u59cb\u6642\u3068\u7d42\u4e86\u6642\u306b\u6642\u9593\u3092\u8a18\u9332\u3057\u3001\u305d\u306e\u5dee\u5206\u3092\u8a08\u7b97\u3059\u308b\u3053\u3068\u3067\u3001\u5404\u90e8\u5206\u306e\u5b9f\u884c\u6642\u9593\u3092\u628a\u63e1\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u3068\u306a\u3063\u3066\u3044\u308b\u7b87\u6240\u3092\u7279\u5b9a\u3057\u3001\u96c6\u4e2d\u7684\u306b\u6700\u9069\u5316\u3092\u884c\u3046\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u3088\u308a\u9ad8\u5ea6\u306a\u30d7\u30ed\u30d5\u30a1\u30a4\u30ea\u30f3\u30b0\u30c4\u30fc\u30eb\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3084CPU\u4f7f\u7528\u7387\u306a\u3069\u306e\u8a73\u7d30\u306a\u60c5\u5831\u3082\u5f97\u3089\u308c\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u60c5\u5831\u306f\u3001\u7279\u306b\u5927\u898f\u6a21\u306aExcel \u30de\u30af\u30ed\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u304a\u3044\u3066\u3001\u5168\u4f53\u7684\u306a\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u5411\u4e0a\u306b\u5927\u304d\u304f\u8ca2\u732e\u3057\u307e\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30d5\u30a1\u30a4\u30ea\u30f3\u30b0\u306e\u7d50\u679c\u3092\u57fa\u306b\u3001\u30b3\u30fc\u30c9\u306e\u69cb\u9020\u3092\u898b\u76f4\u3057\u305f\u308a\u3001\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u6539\u5584\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u52b9\u7387\u7684\u3067\u9ad8\u901f\u306aExcel \u30de\u30af\u30ed\u3092\u958b\u767a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0a\u7d1a\u8005\u5411\u3051VBA\u30c7\u30d0\u30c3\u30b0\u30c6\u30af\u30cb\u30c3\u30af\u3068\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30d7\u30ed\u30d5\u30a1\u30a4\u30ea\u30f3\u30b0 \u3059\u3050\u306b\u8a66\u305b\u308b\u30de\u30af\u30ed\u30b3\u30fc\u30c9 #8220;`vba Sub HighlightDuplicates() Dim rng As Range Dim cell<\/p>\n","protected":false},"author":2,"featured_media":574,"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-575","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\/575","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=575"}],"version-history":[{"count":0,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts\/575\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media\/574"}],"wp:attachment":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media?parent=575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/categories?post=575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/tags?post=575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}