{"id":225,"date":"2024-12-11T22:25:28","date_gmt":"2024-12-11T13:25:28","guid":{"rendered":"https:\/\/hajidai.com\/excel\/2024\/12\/excel%e4%b8%8a%e7%b4%9a%e8%80%85%e3%81%b8%e3%81%ae%e6%8c%91%e6%88%a6%ef%bc%9a1%e5%88%86%e3%81%a7%e5%ae%8c%e4%ba%86%e3%81%99%e3%82%8b%e9%ab%98%e5%ba%a6%e3%83%87%e3%83%bc%e3%82%bf%e5%88%86%e6%9e%90\/"},"modified":"2024-12-11T22:56:40","modified_gmt":"2024-12-11T13:56:40","slug":"excel%e4%b8%8a%e7%b4%9a%e8%80%85%e3%81%b8%e3%81%ae%e6%8c%91%e6%88%a6%ef%bc%9a1%e5%88%86%e3%81%a7%e5%ae%8c%e4%ba%86%e3%81%99%e3%82%8b%e9%ab%98%e5%ba%a6%e3%83%87%e3%83%bc%e3%82%bf%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"https:\/\/hajidai.com\/excel\/2024\/12\/excel%e4%b8%8a%e7%b4%9a%e8%80%85%e3%81%b8%e3%81%ae%e6%8c%91%e6%88%a6%ef%bc%9a1%e5%88%86%e3%81%a7%e5%ae%8c%e4%ba%86%e3%81%99%e3%82%8b%e9%ab%98%e5%ba%a6%e3%83%87%e3%83%bc%e3%82%bf%e5%88%86%e6%9e%90\/","title":{"rendered":"&#8220;Excel\u4e0a\u7d1a\u8005\u3078\u306e\u6311\u6226\uff1a1\u5206\u3067\u5b8c\u4e86\u3059\u308b\u9ad8\u5ea6\u30c7\u30fc\u30bf\u5206\u6790\u3068\u81ea\u52d5\u53ef\u8996\u5316\u30de\u30af\u30ed\u306e\u79d8\u8a23&#8221;"},"content":{"rendered":"<h2>\u4e0a\u7d1a\u8005\u5411\u3051\uff1a\u5373\u52b9\u6027\u306e\u3042\u308b\u30de\u30af\u30ed\u30b3\u30fc\u30c9<\/h2>\n<p>\u4ee5\u4e0b\u306f\u3001\u30c7\u30fc\u30bf\u306e\u52d5\u7684\u51e6\u7406\u3092\u81ea\u52d5\u5316\u3059\u308b\u5f37\u529b\u306a\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u3067\u3059\uff1a<\/p>\n<p>&#8220;`vba<br \/>\nSub \u52d5\u7684\u30c7\u30fc\u30bf\u51e6\u7406()<br \/>\n    Dim ws As Worksheet<br \/>\n    Dim lastRow As Long, i As Long<\/p>\n<p>    Set ws = ThisWorkbook.Sheets(&#8220;\u30c7\u30fc\u30bf\u30b7\u30fc\u30c8&#8221;)<br \/>\n    lastRow = ws.Cells(ws.Rows.Count, &#8220;A&#8221;).End(xlUp).Row<\/p>\n<p>    For i = 2 To lastRow<br \/>\n        If ws.Cells(i, 2).Value > 1000 Then<br \/>\n            ws.Cells(i, 3).Value = &#8220;\u9ad8\u984d&#8221;<br \/>\n        Else<br \/>\n            ws.Cells(i, 3).Value = &#8220;\u901a\u5e38&#8221;<br \/>\n        End If<br \/>\n    Next i<\/p>\n<p>    MsgBox &#8220;\u51e6\u7406\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3002&#8221;, vbInformation<br \/>\nEnd Sub<br \/>\n&#8220;`<\/p>\n<p>\u3053\u306eExcel \u30de\u30af\u30ed\u306f\u3001\u6307\u5b9a\u3055\u308c\u305f\u30b7\u30fc\u30c8\u5185\u306e\u30c7\u30fc\u30bf\u3092\u81ea\u52d5\u7684\u306b\u5206\u985e\u3057\u3001\u7d50\u679c\u3092\u65b0\u3057\u3044\u5217\u306b\u51fa\u529b\u3057\u307e\u3059\u3002<\/p>\n<h2>1. \u52d5\u7684\u30c7\u30fc\u30bf\u51e6\u7406\u306e\u91cd\u8981\u6027<\/h2>\n<p>Excel\u4e0a\u7d1a\u8005\u306b\u3068\u3063\u3066\u3001\u52d5\u7684\u30c7\u30fc\u30bf\u51e6\u7406\u306f\u696d\u52d9\u52b9\u7387\u5316\u306e\u8981\u3068\u306a\u308a\u307e\u3059\u3002\u9759\u7684\u306a\u30c7\u30fc\u30bf\u51e6\u7406\u3067\u306f\u5bfe\u5fdc\u3057\u304d\u308c\u306a\u3044\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3084\u3001\u983b\u7e41\u306b\u5909\u66f4\u304c\u767a\u751f\u3059\u308b\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306b\u5bfe\u3057\u3066\u3001Excel \u30de\u30af\u30ed\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u67d4\u8edf\u304b\u3064\u8fc5\u901f\u306a\u51e6\u7406\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u65e5\u3005\u66f4\u65b0\u3055\u308c\u308b\u58f2\u4e0a\u30c7\u30fc\u30bf\u3092\u81ea\u52d5\u7684\u306b\u96c6\u8a08\u3057\u3001\u30ec\u30dd\u30fc\u30c8\u3092\u751f\u6210\u3059\u308b\u30de\u30af\u30ed\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3067\u3001\u624b\u4f5c\u696d\u306b\u3088\u308b\u96c6\u8a08\u30df\u30b9\u3092\u9632\u304e\u3001\u30ec\u30dd\u30fc\u30c8\u4f5c\u6210\u6642\u9593\u3092\u5927\u5e45\u306b\u77ed\u7e2e\u3067\u304d\u307e\u3059\u3002\u307e\u305f\u3001\u30c7\u30fc\u30bf\u306e\u5f62\u5f0f\u3084\u91cf\u304c\u5909\u5316\u3057\u3066\u3082\u3001\u30de\u30af\u30ed\u5185\u3067\u30c7\u30fc\u30bf\u7bc4\u56f2\u3092\u52d5\u7684\u306b\u6c7a\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u5e38\u306b\u6b63\u78ba\u306a\u51e6\u7406\u3092\u7dad\u6301\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>2. \u9ad8\u5ea6\u306a\u30de\u30af\u30ed\u30c6\u30af\u30cb\u30c3\u30af<\/h2>\n<p>Excel \u30de\u30af\u30ed\u306e\u771f\u4fa1\u3092\u767a\u63ee\u3059\u308b\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u9ad8\u5ea6\u306a\u30c6\u30af\u30cb\u30c3\u30af\u306e\u7fd2\u5f97\u304c\u4e0d\u53ef\u6b20\u3067\u3059\uff1a<\/p>\n<p>1. \u52d5\u7684\u7bc4\u56f2\u306e\u8a2d\u5b9a\uff1aLastRow\u3084LastColumn\u3092\u4f7f\u7528\u3057\u3066\u3001\u30c7\u30fc\u30bf\u7bc4\u56f2\u3092\u81ea\u52d5\u7684\u306b\u7279\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>2. \u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\uff1aOn Error GoTo\u6587\u3092\u4f7f\u7528\u3057\u3066\u3001\u4e88\u671f\u305b\u306c\u30a8\u30e9\u30fc\u306b\u5bfe\u51e6\u3057\u3001\u30de\u30af\u30ed\u306e\u5b89\u5b9a\u6027\u3092\u9ad8\u3081\u307e\u3059\u3002<\/p>\n<p>3. \u30e6\u30fc\u30b6\u30fc\u30d5\u30a9\u30fc\u30e0\uff1aInputBox\u3084MsgBox\u4ee5\u5916\u306b\u3001\u30ab\u30b9\u30bf\u30e0\u306e\u30e6\u30fc\u30b6\u30fc\u30d5\u30a9\u30fc\u30e0\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u76f4\u611f\u7684\u306a\u64cd\u4f5c\u74b0\u5883\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/p>\n<p>4. \u5916\u90e8\u30c7\u30fc\u30bf\u9023\u643a\uff1aADO\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3057\u305f\u308a\u3001WebRequest\u3092\u5229\u7528\u3057\u3066WebAPI\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u306a\u3069\u3001\u5916\u90e8\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3068\u306e\u9023\u643a\u3092\u5b9f\u73fe\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3089\u306e\u30c6\u30af\u30cb\u30c3\u30af\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u67d4\u8edf\u3067\u5f37\u529b\u306aExcel \u30de\u30af\u30ed\u3092\u958b\u767a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>3. \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316<\/h2>\n<p>\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u969b\u3001\u30de\u30af\u30ed\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u554f\u984c\u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u6700\u9069\u5316\u30c6\u30af\u30cb\u30c3\u30af\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u51e6\u7406\u901f\u5ea6\u3092\u5927\u5e45\u306b\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff1a<\/p>\n<p>1. \u30b9\u30af\u30ea\u30fc\u30f3\u66f4\u65b0\u306e\u7121\u52b9\u5316\uff1aApplication.ScreenUpdating = False\u3092\u4f7f\u7528\u3057\u3066\u3001\u51e6\u7406\u4e2d\u306e\u753b\u9762\u66f4\u65b0\u3092\u505c\u6b62\u3057\u307e\u3059\u3002<\/p>\n<p>2. \u8a08\u7b97\u306e\u4e00\u6642\u505c\u6b62\uff1aApplication.Calculation = xlCalculationManual\u3067\u81ea\u52d5\u8a08\u7b97\u3092\u4e00\u6642\u7684\u306b\u7121\u52b9\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>3. \u30a4\u30d9\u30f3\u30c8\u306e\u7121\u52b9\u5316\uff1aApplication.EnableEvents = False\u3067\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u30a4\u30d9\u30f3\u30c8\u3092\u7121\u52b9\u5316\u3057\u3001\u4e0d\u8981\u306a\u51e6\u7406\u3092\u9632\u304e\u307e\u3059\u3002<\/p>\n<p>4. \u30bb\u30eb\u53c2\u7167\u306e\u6700\u5c0f\u5316\uff1a\u53ef\u80fd\u306a\u9650\u308aRange\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5909\u6570\u306b\u683c\u7d0d\u3057\u3001\u76f4\u63a5\u306e\u30bb\u30eb\u53c2\u7167\u3092\u6e1b\u3089\u3057\u307e\u3059\u3002<\/p>\n<p>5. \u914d\u5217\u306e\u6d3b\u7528\uff1a\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u64cd\u4f5c\u6642\u306f\u3001\u30bb\u30eb\u5358\u4f4d\u306e\u64cd\u4f5c\u3067\u306f\u306a\u304f\u914d\u5217\u3092\u4f7f\u7528\u3057\u3066\u30e1\u30e2\u30ea\u4e0a\u3067\u51e6\u7406\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3089\u306e\u6700\u9069\u5316\u30c6\u30af\u30cb\u30c3\u30af\u3092\u9069\u5207\u306b\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001Excel \u30de\u30af\u30ed\u306e\u5b9f\u884c\u901f\u5ea6\u3092\u5287\u7684\u306b\u5411\u4e0a\u3055\u305b\u3001\u3088\u308a\u52b9\u7387\u7684\u306a\u30c7\u30fc\u30bf\u51e6\u7406\u3092\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0a\u7d1a\u8005\u5411\u3051\uff1a\u5373\u52b9\u6027\u306e\u3042\u308b\u30de\u30af\u30ed\u30b3\u30fc\u30c9 \u4ee5\u4e0b\u306f\u3001\u30c7\u30fc\u30bf\u306e\u52d5\u7684\u51e6\u7406\u3092\u81ea\u52d5\u5316\u3059\u308b\u5f37\u529b\u306a\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u3067\u3059\uff1a #8220;`vba Sub \u52d5\u7684\u30c7\u30fc\u30bf\u51e6\u7406() Dim ws As Worksheet Dim lastRow As<\/p>\n","protected":false},"author":2,"featured_media":224,"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-225","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\/225","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=225"}],"version-history":[{"count":1,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts\/225\/revisions"}],"predecessor-version":[{"id":226,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts\/225\/revisions\/226"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media\/224"}],"wp:attachment":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media?parent=225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/categories?post=225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/tags?post=225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}