{"id":346,"date":"2024-12-30T02:33:34","date_gmt":"2024-12-29T17:33:34","guid":{"rendered":"https:\/\/hajidai.com\/excel\/2024\/12\/excel%e4%b8%8a%e7%b4%9a%e8%80%85%e5%bf%85%e8%a6%8b%ef%bc%81%e8%a4%87%e6%95%b0%e3%82%b7%e3%83%bc%e3%83%88%e3%83%bb%e3%83%96%e3%83%83%e3%82%af%e3%82%92%e7%9e%ac%e6%99%82%e3%81%ab%e9%80%a3%e6%90%ba\/"},"modified":"2024-12-30T02:33:34","modified_gmt":"2024-12-29T17:33:34","slug":"excel%e4%b8%8a%e7%b4%9a%e8%80%85%e5%bf%85%e8%a6%8b%ef%bc%81%e8%a4%87%e6%95%b0%e3%82%b7%e3%83%bc%e3%83%88%e3%83%bb%e3%83%96%e3%83%83%e3%82%af%e3%82%92%e7%9e%ac%e6%99%82%e3%81%ab%e9%80%a3%e6%90%ba","status":"publish","type":"post","link":"https:\/\/hajidai.com\/excel\/2024\/12\/excel%e4%b8%8a%e7%b4%9a%e8%80%85%e5%bf%85%e8%a6%8b%ef%bc%81%e8%a4%87%e6%95%b0%e3%82%b7%e3%83%bc%e3%83%88%e3%83%bb%e3%83%96%e3%83%83%e3%82%af%e3%82%92%e7%9e%ac%e6%99%82%e3%81%ab%e9%80%a3%e6%90%ba\/","title":{"rendered":"Excel\u4e0a\u7d1a\u8005\u5fc5\u898b\uff01\u8907\u6570\u30b7\u30fc\u30c8\u30fb\u30d6\u30c3\u30af\u3092\u77ac\u6642\u306b\u9023\u643a\u3059\u308b\u9b54\u6cd5\u306e\u30de\u30af\u30ed\u30c6\u30af\u30cb\u30c3\u30af"},"content":{"rendered":"<h2>\u4e0a\u7d1a\u8005\u5411\u3051\u30de\u30af\u30ed\u30b3\u30fc\u30c9\uff1a\u8907\u6570\u30b7\u30fc\u30c8\u30fb\u30d6\u30c3\u30af\u306e\u30c7\u30fc\u30bf\u9023\u643a<\/h2>\n<p>&#8220;`vba<br \/>\nSub MultiSheetBookDataLink()<br \/>\n    Dim wb As Workbook, ws As Worksheet<br \/>\n    Dim lastRow As Long, i As Long<\/p>\n<p>    &#8216; \u73fe\u5728\u306e\u30d6\u30c3\u30af\u3092\u8a2d\u5b9a<br \/>\n    Set wb = ThisWorkbook<\/p>\n<p>    &#8216; \u5168\u30b7\u30fc\u30c8\u3092\u30eb\u30fc\u30d7<br \/>\n    For Each ws In wb.Worksheets<br \/>\n        lastRow = ws.Cells(ws.Rows.Count, &#8220;A&#8221;).End(xlUp).Row<\/p>\n<p>        &#8216; \u5404\u884c\u306e\u30c7\u30fc\u30bf\u3092\u51e6\u7406<br \/>\n        For i = 2 To lastRow<br \/>\n            &#8216; \u3053\u3053\u306b\u30c7\u30fc\u30bf\u51e6\u7406\u30ed\u30b8\u30c3\u30af\u3092\u8a18\u8ff0<br \/>\n            &#8216; \u4f8b\uff1a\u4ed6\u306e\u30b7\u30fc\u30c8\u3084\u30d6\u30c3\u30af\u306b\u30c7\u30fc\u30bf\u3092\u30b3\u30d4\u30fc<br \/>\n        Next i<br \/>\n    Next ws<\/p>\n<p>    MsgBox &#8220;\u30c7\u30fc\u30bf\u9023\u643a\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3002&#8221;, vbInformation<br \/>\nEnd Sub<br \/>\n&#8220;`<\/p>\n<h2>1. \u30de\u30eb\u30c1\u30b7\u30fc\u30c8\u51e6\u7406\u306e\u52b9\u7387\u5316<\/h2>\n<p>Excel\u3067\u8907\u6570\u306e\u30b7\u30fc\u30c8\u3092\u6271\u3046\u969b\u3001\u30c7\u30fc\u30bf\u306e\u6574\u7406\u3084\u5206\u6790\u304c\u7169\u96d1\u306b\u306a\u308a\u304c\u3061\u3067\u3059\u3002\u3057\u304b\u3057\u3001\u30de\u30af\u30ed\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u3053\u306e\u4f5c\u696d\u3092\u5927\u5e45\u306b\u52b9\u7387\u5316\u3067\u304d\u307e\u3059\u3002\u4e0a\u8a18\u306e\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u306f\u3001\u73fe\u5728\u306e\u30d6\u30c3\u30af\u5185\u306e\u5168\u30b7\u30fc\u30c8\u3092\u9806\u306b\u51e6\u7406\u3057\u3001\u5404\u30b7\u30fc\u30c8\u306e\u7279\u5b9a\u5217\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3066\u51e6\u7406\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306a\u30de\u30af\u30ed\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u4f8b\u3048\u3070\u6708\u6b21\u5831\u544a\u66f8\u306e\u4f5c\u6210\u3084\u3001\u8907\u6570\u90e8\u7f72\u304b\u3089\u306e\u30c7\u30fc\u30bf\u96c6\u8a08\u306a\u3069\u3001\u7e70\u308a\u8fd4\u3057\u4f5c\u696d\u304c\u591a\u3044\u696d\u52d9\u3092\u81ea\u52d5\u5316\u3067\u304d\u307e\u3059\u3002\u30de\u30af\u30ed\u306e\u4e2d\u8eab\u3092\u76ee\u7684\u306b\u5fdc\u3058\u3066\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u3053\u3068\u3067\u3001\u69d8\u3005\u306a\u5834\u9762\u3067\u6d3b\u7528\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<h2>2. \u30de\u30eb\u30c1\u30d6\u30c3\u30af\u30c7\u30fc\u30bf\u9023\u643a\u306e\u30c6\u30af\u30cb\u30c3\u30af<\/h2>\n<p>\u8907\u6570\u306e\u30d6\u30c3\u30af\u306b\u307e\u305f\u304c\u308b\u30c7\u30fc\u30bf\u51e6\u7406\u3082\u3001Excel \u30de\u30af\u30ed\u3092\u4f7f\u3048\u3070\u7c21\u5358\u306b\u884c\u3048\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067\u3001\u4ed6\u306e\u30d6\u30c3\u30af\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3001\u73fe\u5728\u306e\u30d6\u30c3\u30af\u306b\u7d71\u5408\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff1a<\/p>\n<p>&#8220;`vba<br \/>\nDim sourceWb As Workbook<br \/>\nSet sourceWb = Workbooks.Open(&#8220;C:\\path\\to\\source.xlsx&#8221;)<br \/>\n&#8216; \u3053\u3053\u306b\u30bd\u30fc\u30b9\u30d6\u30c3\u30af\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0<br \/>\nsourceWb.Close SaveChanges:=False<br \/>\n&#8220;`<\/p>\n<p>\u3053\u306e\u30c6\u30af\u30cb\u30c3\u30af\u3092\u4f7f\u3048\u3070\u3001\u8907\u6570\u306e\u90e8\u9580\u3084\u652f\u793e\u304b\u3089\u306e\u30c7\u30fc\u30bf\u3092\u4e00\u3064\u306e\u30ec\u30dd\u30fc\u30c8\u306b\u307e\u3068\u3081\u308b\u4f5c\u696d\u3084\u3001\u7570\u306a\u308b\u30b7\u30b9\u30c6\u30e0\u304b\u3089\u51fa\u529b\u3055\u308c\u305f\u30c7\u30fc\u30bf\u306e\u7d71\u5408\u306a\u3069\u304c\u5bb9\u6613\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>3. \u30c7\u30fc\u30bf\u9023\u643a\u306b\u304a\u3051\u308b\u30a8\u30e9\u30fc\u51e6\u7406\u3068\u6700\u9069\u5316<\/h2>\n<p>\u30de\u30eb\u30c1\u30b7\u30fc\u30c8\u30fb\u30de\u30eb\u30c1\u30d6\u30c3\u30af\u51e6\u7406\u3092\u884c\u3046\u969b\u306f\u3001\u30a8\u30e9\u30fc\u51e6\u7406\u3068\u51e6\u7406\u901f\u5ea6\u306e\u6700\u9069\u5316\u304c\u91cd\u8981\u3067\u3059\u3002\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u51e6\u7406\u3092\u7d44\u307f\u8fbc\u3080\u3053\u3068\u3067\u3001\u4e88\u671f\u305b\u306c\u30a8\u30e9\u30fc\u306b\u3082\u5bfe\u5fdc\u3067\u304d\u307e\u3059\uff1a<\/p>\n<p>&#8220;`vba<br \/>\nOn Error GoTo ErrorHandler<br \/>\n&#8216; \u30e1\u30a4\u30f3\u51e6\u7406\u30b3\u30fc\u30c9<br \/>\nExit Sub<\/p>\n<p>ErrorHandler:<br \/>\nMsgBox &#8220;\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: &#8221; &#038; Err.Description, vbCritical<br \/>\nResume Next<br \/>\n&#8220;`<\/p>\n<p>\u307e\u305f\u3001\u51e6\u7406\u901f\u5ea6\u3092\u5411\u4e0a\u3055\u305b\u308b\u305f\u3081\u306b\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u6700\u9069\u5316\u30c6\u30af\u30cb\u30c3\u30af\u3092\u4f7f\u7528\u3067\u304d\u307e\u3059\uff1a<\/p>\n<p>1. \u753b\u9762\u66f4\u65b0\u306e\u4e00\u6642\u505c\u6b62\uff1a`Application.ScreenUpdating = False`<br \/>\n2. \u8a08\u7b97\u306e\u4e00\u6642\u505c\u6b62\uff1a`Application.Calculation = xlCalculationManual`<br \/>\n3. \u30a4\u30d9\u30f3\u30c8\u306e\u4e00\u6642\u505c\u6b62\uff1a`Application.EnableEvents = False`<\/p>\n<p>\u3053\u308c\u3089\u306e\u30c6\u30af\u30cb\u30c3\u30af\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u6271\u3046\u969b\u3067\u3082\u30b9\u30e0\u30fc\u30ba\u306a\u51e6\u7406\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>Excel \u30de\u30af\u30ed\u3092\u6d3b\u7528\u3057\u305f\u30de\u30eb\u30c1\u30b7\u30fc\u30c8\u30fb\u30de\u30eb\u30c1\u30d6\u30c3\u30af\u51e6\u7406\u306f\u3001\u30c7\u30fc\u30bf\u9023\u643a\u306e\u65b0\u305f\u306a\u53ef\u80fd\u6027\u3092\u958b\u304d\u307e\u3059\u3002\u521d\u3081\u306f\u96e3\u3057\u304f\u611f\u3058\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u5c11\u3057\u305a\u3064\u8a66\u3057\u3066\u3044\u304f\u3053\u3068\u3067\u3001\u696d\u52d9\u52b9\u7387\u5316\u306e\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3068\u306a\u308b\u3067\u3057\u3087\u3046\u3002\u305c\u3072\u3001\u81ea\u5206\u306e\u696d\u52d9\u306b\u5408\u308f\u305b\u3066\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u3001\u6d3b\u7528\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0a\u7d1a\u8005\u5411\u3051\u30de\u30af\u30ed\u30b3\u30fc\u30c9\uff1a\u8907\u6570\u30b7\u30fc\u30c8\u30fb\u30d6\u30c3\u30af\u306e\u30c7\u30fc\u30bf\u9023\u643a #8220;`vba Sub MultiSheetBookDataLink() Dim wb As Workbook, ws As Worksheet Dim l<\/p>\n","protected":false},"author":2,"featured_media":345,"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-346","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\/346","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=346"}],"version-history":[{"count":0,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts\/346\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media\/345"}],"wp:attachment":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media?parent=346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/categories?post=346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/tags?post=346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}