{"id":239,"date":"2024-12-13T14:33:36","date_gmt":"2024-12-13T05:33:36","guid":{"rendered":"https:\/\/hajidai.com\/excel\/2024\/12\/excel-vba%e4%b8%8a%e7%b4%9a%e8%80%85%e5%bf%85%e8%a6%8b%ef%bc%81%e3%82%a8%e3%83%a9%e3%83%bc%e3%83%8f%e3%83%b3%e3%83%89%e3%83%aa%e3%83%b3%e3%82%b0%e3%81%ae%e6%a5%b5%e6%84%8f%e3%81%a84%e3%81%a4%e3%81%ae\/"},"modified":"2024-12-13T14:33:36","modified_gmt":"2024-12-13T05:33:36","slug":"excel-vba%e4%b8%8a%e7%b4%9a%e8%80%85%e5%bf%85%e8%a6%8b%ef%bc%81%e3%82%a8%e3%83%a9%e3%83%bc%e3%83%8f%e3%83%b3%e3%83%89%e3%83%aa%e3%83%b3%e3%82%b0%e3%81%ae%e6%a5%b5%e6%84%8f%e3%81%a84%e3%81%a4%e3%81%ae","status":"publish","type":"post","link":"https:\/\/hajidai.com\/excel\/2024\/12\/excel-vba%e4%b8%8a%e7%b4%9a%e8%80%85%e5%bf%85%e8%a6%8b%ef%bc%81%e3%82%a8%e3%83%a9%e3%83%bc%e3%83%8f%e3%83%b3%e3%83%89%e3%83%aa%e3%83%b3%e3%82%b0%e3%81%ae%e6%a5%b5%e6%84%8f%e3%81%a84%e3%81%a4%e3%81%ae\/","title":{"rendered":"Excel VBA\u4e0a\u7d1a\u8005\u5fc5\u898b\uff01\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u306e\u6975\u610f\u30684\u3064\u306e\u9ad8\u5ea6\u306a\u5b9f\u88c5\u30c6\u30af\u30cb\u30c3\u30af"},"content":{"rendered":"<h2>Excel\u4e0a\u7d1a\u8005\u306e\u305f\u3081\u306e\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3068\u4f8b\u5916\u51e6\u7406\u306e\u9ad8\u5ea6\u306a\u5b9f\u88c5<\/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\u4e0a\u7d1a\u8005\u306e\u65b9\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 ErrorHandlingExample()<br \/>\n    On Error GoTo ErrorHandler<\/p>\n<p>    &#8216; \u30a8\u30e9\u30fc\u3092\u767a\u751f\u3055\u305b\u308b\u51e6\u7406<br \/>\n    Dim x As Integer<br \/>\n    x = 1 \/ 0<\/p>\n<p>    Exit Sub<\/p>\n<p>ErrorHandler:<br \/>\n    MsgBox &#8220;\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: &#8221; &#038; Err.Description<br \/>\n    Resume Next<br \/>\nEnd Sub<br \/>\n&#8220;`<\/p>\n<p>\u3053\u306e\u30de\u30af\u30ed\u306f\u3001\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u306e\u57fa\u672c\u7684\u306a\u69cb\u9020\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3057\u3001\u6b21\u306e\u884c\u304b\u3089\u51e6\u7406\u3092\u7d9a\u884c\u3057\u307e\u3059\u3002<\/p>\n<h3>1. \u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u306e\u91cd\u8981\u6027<\/h3>\n<p>Excel \u30de\u30af\u30ed\u3092\u4f5c\u6210\u3059\u308b\u969b\u3001\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u306f\u975e\u5e38\u306b\u91cd\u8981\u3067\u3059\u3002\u9069\u5207\u306a\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3092\u5b9f\u88c5\u3059\u308b\u3053\u3068\u3067\u3001\u4e88\u671f\u305b\u306c\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u969b\u306b\u3082\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u9069\u5207\u306b\u5bfe\u5fdc\u3057\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u5206\u304b\u308a\u3084\u3059\u3044\u60c5\u5831\u3092\u63d0\u4f9b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u307e\u305f\u3001\u30c7\u30d0\u30c3\u30b0\uff08\u6ce8\uff1a\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30d0\u30b0\u3092\u898b\u3064\u3051\u3066\u4fee\u6b63\u3059\u308b\u3053\u3068\uff09\u306e\u969b\u306b\u3082\u5f79\u7acb\u3061\u307e\u3059\u3002<\/p>\n<p>\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u306e\u57fa\u672c\u7684\u306a\u69cb\u9020\u306f\u3001\u300cOn Error GoTo\u300d\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u969b\u306b\u7279\u5b9a\u306e\u30e9\u30d9\u30eb\uff08\u4f8b\uff1aErrorHandler\uff09\u306b\u51e6\u7406\u3092\u79fb\u52d5\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>2. \u4f8b\u5916\u51e6\u7406\u306e\u9ad8\u5ea6\u306a\u5b9f\u88c5<\/h3>\n<p>\u3088\u308a\u9ad8\u5ea6\u306a\u4f8b\u5916\u51e6\u7406\u3092\u5b9f\u88c5\u3059\u308b\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\uff1a<\/p>\n<p>1. \u30a8\u30e9\u30fc\u306e\u7a2e\u985e\u306b\u5fdc\u3058\u3066\u7570\u306a\u308b\u51e6\u7406\u3092\u884c\u3046<br \/>\n2. \u30a8\u30e9\u30fc\u30ed\u30b0\u3092\u4f5c\u6210\u3057\u3001\u5f8c\u3067\u5206\u6790\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<br \/>\n3. \u7279\u5b9a\u306e\u6761\u4ef6\u4e0b\u3067\u306e\u307f\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3092\u6709\u52b9\u306b\u3059\u308b<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30a8\u30e9\u30fc\u306e\u7a2e\u985e\u306b\u5fdc\u3058\u3066\u7570\u306a\u308b\u51e6\u7406\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff1a<\/p>\n<p>&#8220;`vba<br \/>\nSub AdvancedErrorHandling()<br \/>\n    On Error GoTo ErrorHandler<\/p>\n<p>    &#8216; \u30a8\u30e9\u30fc\u3092\u767a\u751f\u3055\u305b\u308b\u51e6\u7406<br \/>\n    Dim x As Integer<br \/>\n    x = 1 \/ 0<\/p>\n<p>    Exit Sub<\/p>\n<p>ErrorHandler:<br \/>\n    Select Case Err.Number<br \/>\n        Case 11  &#8216; 0\u3067\u9664\u7b97<br \/>\n            MsgBox &#8220;0\u3067\u9664\u7b97\u3057\u3088\u3046\u3068\u3057\u307e\u3057\u305f\u3002&#8221;<br \/>\n        Case 13  &#8216; \u578b\u304c\u4e00\u81f4\u3057\u306a\u3044<br \/>\n            MsgBox &#8220;\u30c7\u30fc\u30bf\u578b\u304c\u4e00\u81f4\u3057\u307e\u305b\u3093\u3002&#8221;<br \/>\n        Case Else<br \/>\n            MsgBox &#8220;\u4e88\u671f\u305b\u306c\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: &#8221; &#038; Err.Description<br \/>\n    End Select<br \/>\n    Resume Next<br \/>\nEnd Sub<br \/>\n&#8220;`<\/p>\n<h3>3. \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3068\u306e\u30d0\u30e9\u30f3\u30b9<\/h3>\n<p>\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3068\u4f8b\u5916\u51e6\u7406\u306f\u91cd\u8981\u3067\u3059\u304c\u3001\u904e\u5ea6\u306b\u8907\u96d1\u306a\u5b9f\u88c5\u306f\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u5f71\u97ff\u3092\u4e0e\u3048\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\u7279\u306b\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u6271\u3046 Excel \u30de\u30af\u30ed\u3067\u306f\u3001\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u306e\u51e6\u7406\u304c\u983b\u7e41\u306b\u547c\u3073\u51fa\u3055\u308c\u308b\u3068\u3001\u5b9f\u884c\u901f\u5ea6\u304c\u4f4e\u4e0b\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u53ef\u80fd\u6027\u304c\u9ad8\u3044\u7b87\u6240\u3084\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u969b\u306b\u91cd\u5927\u306a\u5f71\u97ff\u304c\u3042\u308b\u7b87\u6240\u306b\u7d5e\u3063\u3066\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3092\u5b9f\u88c5\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u307e\u305f\u3001\u30a8\u30e9\u30fc\u30ed\u30b0\u306e\u4f5c\u6210\u306a\u3069\u306e\u51e6\u7406\u306f\u3001\u5fc5\u8981\u6700\u5c0f\u9650\u306b\u6291\u3048\u308b\u3053\u3068\u3067\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3068\u306e\u30d0\u30e9\u30f3\u30b9\u3092\u53d6\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0a\u306e\u30dd\u30a4\u30f3\u30c8\u3092\u62bc\u3055\u3048\u308b\u3053\u3068\u3067\u3001Excel\u4e0a\u7d1a\u8005\u306e\u65b9\u3005\u306f\u3001\u3088\u308a\u5805\u7262\u3067\u52b9\u7387\u7684\u306a\u30de\u30af\u30ed\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3068\u4f8b\u5916\u51e6\u7406\u306e\u9ad8\u5ea6\u306a\u5b9f\u88c5\u306f\u3001Excel \u30de\u30af\u30ed\u306e\u54c1\u8cea\u3092\u5927\u304d\u304f\u5411\u4e0a\u3055\u305b\u3001\u30e6\u30fc\u30b6\u30fc\u30a8\u30af\u30b9\u30da\u30ea\u30a8\u30f3\u30b9\u3092\u5411\u4e0a\u3055\u305b\u308b\u91cd\u8981\u306a\u8981\u7d20\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Excel\u4e0a\u7d1a\u8005\u306e\u305f\u3081\u306e\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3068\u4f8b\u5916\u51e6\u7406\u306e\u9ad8\u5ea6\u306a\u5b9f\u88c5 \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\u4e0a\u7d1a\u8005\u306e\u65b9\u304c\u3059\u3050\u306b\u8a66\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u3067\u3059\uff1a #8220;`vba Sub <\/p>\n","protected":false},"author":2,"featured_media":238,"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-239","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\/239","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=239"}],"version-history":[{"count":0,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts\/239\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media\/238"}],"wp:attachment":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media?parent=239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/categories?post=239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/tags?post=239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}