{"id":641,"date":"2025-05-08T00:49:10","date_gmt":"2025-05-07T15:49:10","guid":{"rendered":"https:\/\/hajidai.com\/excel\/2025\/05\/excel%e3%83%9e%e3%82%b9%e3%82%bf%e3%83%bc%e3%81%b8%e3%81%ae%e3%82%b9%e3%83%86%e3%83%83%e3%83%97%e3%82%a2%e3%83%83%e3%83%97vba%e6%b4%bb%e7%94%a8%e8%a1%93%ef%bc%9a%e3%83%87%e3%83%bc%e3%82%bf%e3%83%99\/"},"modified":"2025-05-08T00:49:10","modified_gmt":"2025-05-07T15:49:10","slug":"excel%e3%83%9e%e3%82%b9%e3%82%bf%e3%83%bc%e3%81%b8%e3%81%ae%e3%82%b9%e3%83%86%e3%83%83%e3%83%97%e3%82%a2%e3%83%83%e3%83%97vba%e6%b4%bb%e7%94%a8%e8%a1%93%ef%bc%9a%e3%83%87%e3%83%bc%e3%82%bf%e3%83%99","status":"publish","type":"post","link":"https:\/\/hajidai.com\/excel\/2025\/05\/excel%e3%83%9e%e3%82%b9%e3%82%bf%e3%83%bc%e3%81%b8%e3%81%ae%e3%82%b9%e3%83%86%e3%83%83%e3%83%97%e3%82%a2%e3%83%83%e3%83%97vba%e6%b4%bb%e7%94%a8%e8%a1%93%ef%bc%9a%e3%83%87%e3%83%bc%e3%82%bf%e3%83%99\/","title":{"rendered":"Excel\u30de\u30b9\u30bf\u30fc\u3078\u306e\u30b9\u30c6\u30c3\u30d7\u30a2\u30c3\u30d7VBA\u6d3b\u7528\u8853\uff1a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u9023\u643a\u304b\u3089AI\u7d71\u5408\u307e\u30675\u3064\u306e\u4e0a\u7d1a\u30c6\u30af\u30cb\u30c3\u30af"},"content":{"rendered":"<h2>\u4e0a\u7d1a\u8005\u5411\u3051Excel\u30de\u30af\u30ed\u3067\u696d\u52d9\u52b9\u7387\u5316\uff01<\/h2>\n<p>\u307e\u305a\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\u3005\u306b\u5411\u3051\u3066\u3001\u3059\u3050\u306b\u8a66\u305b\u308b\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>&#8220;`vba<br \/>\nSub \u81ea\u52d5\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u4f5c\u6210()<br \/>\n    Dim wb As Workbook<br \/>\n    Dim backupPath As String<\/p>\n<p>    Set wb = ActiveWorkbook<br \/>\n    backupPath = wb.Path &#038; &#8220;\\&#8221; &#038; Left(wb.Name, InStrRev(wb.Name, &#8220;.&#8221;) &#8211; 1) &#038; &#8220;_backup_&#8221; &#038; Format(Now, &#8220;yyyymmdd_hhmmss&#8221;) &#038; &#8220;.xlsx&#8221;<\/p>\n<p>    wb.SaveCopyAs backupPath<br \/>\n    MsgBox &#8220;\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u304c\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f: &#8221; &#038; backupPath<br \/>\nEnd Sub<br \/>\n&#8220;`<\/p>\n<p>\u3053\u306e\u30de\u30af\u30ed\u306f\u3001\u73fe\u5728\u958b\u3044\u3066\u3044\u308b\u30d6\u30c3\u30af\u306e\u81ea\u52d5\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u65e5\u6642\u3092\u8ffd\u52a0\u3059\u308b\u306e\u3067\u3001\u8907\u6570\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u4fdd\u5b58\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>1. \u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u7ba1\u7406\u306e\u91cd\u8981\u6027<\/h3>\n<p>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u7ba1\u7406\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3084\u30b7\u30b9\u30c6\u30e0\u306b\u304a\u3044\u3066\u8907\u6570\u306e\u64cd\u4f5c\u3092\u4e00\u3064\u306e\u5358\u4f4d\u3068\u3057\u3066\u6271\u3046\u6982\u5ff5\u3067\u3059\u3002Excel\u3067\u3082\u3001\u8907\u96d1\u306a\u64cd\u4f5c\u3092\u884c\u3046\u969b\u306b\u3053\u306e\u8003\u3048\u65b9\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u306e\u6574\u5408\u6027\u3092\u4fdd\u3064\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b\u969b\u306b\u3001Excel\u30de\u30af\u30ed\u3092\u4f7f\u7528\u3057\u3066\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u7684\u306a\u30a2\u30d7\u30ed\u30fc\u30c1\u3092\u53d6\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u66f4\u65b0\u51e6\u7406\u306e\u958b\u59cb\u6642\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u4f5c\u6210\u3057\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u306b\u306f\u305d\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306b\u623b\u3059\u3068\u3044\u3046\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<h3>2. ACID\u7279\u6027\u306e\u7406\u89e3\u3068\u5fdc\u7528<\/h3>\n<p>ACID\u7279\u6027\uff08\u539f\u5b50\u6027\u3001\u4e00\u8cab\u6027\u3001\u5206\u96e2\u6027\u3001\u6c38\u7d9a\u6027\uff09\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u51e6\u7406\u306b\u304a\u3044\u3066\u91cd\u8981\u306a\u6982\u5ff5\u3067\u3059\u3002Excel\u3067\u306e\u30c7\u30fc\u30bf\u51e6\u7406\u306b\u3082\u3053\u306e\u8003\u3048\u65b9\u3092\u5fdc\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u4fe1\u983c\u6027\u306e\u9ad8\u3044\u64cd\u4f5c\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001Excel\u30de\u30af\u30ed\u3092\u4f7f\u7528\u3057\u3066\u8907\u6570\u306e\u30b7\u30fc\u30c8\u306b\u307e\u305f\u304c\u308b\u30c7\u30fc\u30bf\u66f4\u65b0\u3092\u884c\u3046\u5834\u5408\u3001\u3059\u3079\u3066\u306e\u66f4\u65b0\u304c\u6210\u529f\u3057\u305f\u5834\u5408\u306b\u306e\u307f\u5909\u66f4\u3092\u78ba\u5b9a\u3057\u3001\u4e00\u3064\u3067\u3082\u5931\u6557\u3057\u305f\u5834\u5408\u306b\u306f\u5168\u3066\u306e\u5909\u66f4\u3092\u5143\u306b\u623b\u3059\u3068\u3044\u3046\u51e6\u7406\u3092\u5b9f\u88c5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>3. \u30a8\u30e9\u30fc\u51e6\u7406\u3068\u30ed\u30ae\u30f3\u30b0\u306e\u5b9f\u88c5<\/h3>\n<p>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u7ba1\u7406\u3092\u52b9\u679c\u7684\u306b\u884c\u3046\u305f\u3081\u306b\u306f\u3001\u9069\u5207\u306a\u30a8\u30e9\u30fc\u51e6\u7406\u3068\u30ed\u30ae\u30f3\u30b0\u304c\u4e0d\u53ef\u6b20\u3067\u3059\u3002Excel\u30de\u30af\u30ed\u3067\u306f\u3001VBA\u306e\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u6a5f\u80fd\u3092\u4f7f\u7528\u3057\u3066\u3001\u4e88\u671f\u305b\u306c\u554f\u984c\u306b\u5bfe\u51e6\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306f\u3001\u30a8\u30e9\u30fc\u51e6\u7406\u3068\u30ed\u30ae\u30f3\u30b0\u3092\u542b\u3080\u30de\u30af\u30ed\u306e\u4f8b\u3067\u3059\uff1a<\/p>\n<p>&#8220;`vba<br \/>\nSub \u30c7\u30fc\u30bf\u66f4\u65b0_\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u7ba1\u7406()<br \/>\n    On Error GoTo ErrorHandler<\/p>\n<p>    Dim ws As Worksheet<br \/>\n    Dim logFile As String<\/p>\n<p>    logFile = ThisWorkbook.Path &#038; &#8220;\\update_log.txt&#8221;<\/p>\n<p>    &#8216; \u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f<br \/>\n    Open logFile For Append As #1<\/p>\n<p>    &#8216; \u51e6\u7406\u958b\u59cb<br \/>\n    Print #1, &#8220;\u66f4\u65b0\u958b\u59cb: &#8221; &#038; Now<\/p>\n<p>    &#8216; \u30c7\u30fc\u30bf\u66f4\u65b0\u51e6\u7406<br \/>\n    For Each ws In ThisWorkbook.Worksheets<br \/>\n        &#8216; \u5404\u30b7\u30fc\u30c8\u3067\u306e\u66f4\u65b0\u51e6\u7406<br \/>\n        &#8216; &#8230;<br \/>\n        Print #1, ws.Name &#038; &#8221; \u66f4\u65b0\u5b8c\u4e86&#8221;<br \/>\n    Next ws<\/p>\n<p>    &#8216; \u51e6\u7406\u6210\u529f<br \/>\n    Print #1, &#8220;\u3059\u3079\u3066\u306e\u66f4\u65b0\u304c\u6210\u529f\u3057\u307e\u3057\u305f: &#8221; &#038; Now<br \/>\n    Close #1<br \/>\n    MsgBox &#8220;\u30c7\u30fc\u30bf\u66f4\u65b0\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3002&#8221;<br \/>\n    Exit Sub<\/p>\n<p>ErrorHandler:<br \/>\n    &#8216; \u30a8\u30e9\u30fc\u767a\u751f\u6642\u306e\u51e6\u7406<br \/>\n    Print #1, &#8220;\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: &#8221; &#038; Err.Description &#038; &#8221; &#8221; &#038; Now<br \/>\n    Close #1<br \/>\n    MsgBox &#8220;\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002\u30ed\u30b0\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002&#8221;<br \/>\nEnd Sub<br \/>\n&#8220;`<\/p>\n<p>\u3053\u306e\u30de\u30af\u30ed\u306f\u3001\u8907\u6570\u306e\u30b7\u30fc\u30c8\u306b\u308f\u305f\u308b\u30c7\u30fc\u30bf\u66f4\u65b0\u3092\u884c\u3044\u3001\u51e6\u7406\u306e\u7d4c\u904e\u3092\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306b\u8a18\u9332\u3057\u307e\u3059\u3002\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u3082\u3001\u305d\u306e\u60c5\u5831\u304c\u30ed\u30b0\u306b\u6b8b\u308b\u305f\u3081\u3001\u5f8c\u304b\u3089\u554f\u984c\u306e\u539f\u56e0\u3092\u7279\u5b9a\u3057\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0a\u306e\u3088\u3046\u306b\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u7ba1\u7406\u306e\u8003\u3048\u65b9\u3092Excel\u30de\u30af\u30ed\u306b\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u5805\u7262\u3067\u4fe1\u983c\u6027\u306e\u9ad8\u3044\u30c7\u30fc\u30bf\u51e6\u7406\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002\u4e0a\u7d1a\u8005\u306e\u65b9\u3005\u306f\u3001\u3053\u308c\u3089\u306e\u6982\u5ff5\u3092\u6d3b\u7528\u3057\u3066\u3001\u3088\u308a\u52b9\u7387\u7684\u3067\u5b89\u5168\u306aExcel\u306e\u4f7f\u7528\u65b9\u6cd5\u3092\u6a21\u7d22\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0a\u7d1a\u8005\u5411\u3051Excel\u30de\u30af\u30ed\u3067\u696d\u52d9\u52b9\u7387\u5316\uff01 \u307e\u305a\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\u3005\u306b\u5411\u3051\u3066\u3001\u3059\u3050\u306b\u8a66\u305b\u308b\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002 #8220;`vba Sub \u81ea\u52d5\u30d0\u30c3\u30af\u30a2\u30c3<\/p>\n","protected":false},"author":2,"featured_media":640,"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-641","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\/641","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=641"}],"version-history":[{"count":0,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts\/641\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media\/640"}],"wp:attachment":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media?parent=641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/categories?post=641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/tags?post=641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}