{"id":11191,"date":"2019-02-07T15:05:49","date_gmt":"2019-02-07T06:05:49","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=11191"},"modified":"2019-02-08T10:26:13","modified_gmt":"2019-02-08T01:26:13","slug":"re-%e3%80%90gas%e3%80%91%e6%8c%87%e5%ae%9a%e8%a1%8c%e3%81%ae%e6%9c%80%e7%b5%82%e5%88%97%e7%95%aa%e5%8f%b7%e3%83%bb%e6%8c%87%e5%ae%9a%e5%88%97%e3%81%ae%e6%9c%80%e7%b5%82%e8%a1%8c%e7%95%aa%e5%8f%b7","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=11191","title":{"rendered":"Re: \u3010GAS\u3011\u6307\u5b9a\u884c\u306e\u6700\u7d42\u5217\u756a\u53f7\u30fb\u6307\u5b9a\u5217\u306e\u6700\u7d42\u884c\u756a\u53f7\u3092\u53d6\u5f97\u3059\u308b"},"content":{"rendered":"<p>\u3082\u308a(<a href=\"https:\/\/twitter.com\/moripro3\" title=\"\u3082\u308a@2_16LaravelJPConference\u884c\u304f\u3088(@moripro3)\u3055\u3093\" target=\"_blank\">@moripro3<\/a>)\u3055\u3093\u304c\u30d6\u30ed\u30b0\u3067\u3001Google Apps Script\u3067\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u6700\u7d42\u884c\u3068\u6700\u7d42\u5217\u3092\u53d6\u5f97\u3059\u308b\u30b3\u30fc\u30c9\u3092\u7d39\u4ecb\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<div class=\"linkcard\"><div class=\"lkc-external-wrap\"><a class=\"lkc-link no_icon\" href=\"https:\/\/moripro.net\/gas-lastcol-lastrow\/\" target=\"_blank\" rel=\"external nofollow noopener\"><div class=\"lkc-card\"><div class=\"lkc-info\"><div class=\"lkc-favicon\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.google.com\/s2\/favicons?domain=moripro.net\" alt=\"\" width=\"16\" height=\"16\" \/><\/div><div class=\"lkc-domain\">\u3082\u308a\u3055\u3093\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u624b\u5e33<\/div><\/div><div class=\"lkc-content\"><figure class=\"lkc-thumbnail\"><img decoding=\"async\" class=\"lkc-thumbnail-img\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/pz-linkcard\/cache\/3694ed12a68cb0264f55c33f399d74005508e43c31082539859d48ca0dcd4cfb.jpeg\" width=\"100px\" height=\"108px\" alt=\"\" \/><\/figure><div class=\"lkc-title\">\u3010GAS\u3011\u6307\u5b9a\u884c\u306e\u6700\u7d42\u5217\u756a\u53f7\u30fb\u6307\u5b9a\u5217\u306e\u6700\u7d42\u884c\u756a\u53f7\u3092\u53d6\u5f97\u3059\u308b\uff5c\u3082\u308a\u3055\u3093\u306e\u30d7\u30ed\u30b0\u30e9\u30df...<\/div><div class=\"lkc-url\" title=\"https:\/\/moripro.net\/gas-lastcol-lastrow\/\">https:\/\/moripro.net\/gas-lastcol-lastrow\/<\/div><div class=\"lkc-excerpt\">GoogleAppsScript\u3067\u3001\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u300c\u7279\u5b9a\u306e\u884c\u306e\u6700\u7d42\u5217\u756a\u53f7\u300d\u300c\u7279\u5b9a\u306e\u5217\u306e\u6700\u7d42\u884c\u756a\u53f7\u300d\u3092\u53d6\u5f97\u3059\u308b\u95a2\u6570\u3092\u7d39\u4ecb\u3057\u3066\u3044\u307e\u3059\u3002<\/div><\/div><div class=\"clear\"><\/div><\/div><\/a><\/div><\/div>\n<p>Excel VBA\u3067\u51e6\u7406\u3059\u308b\u306a\u3089<span style=\"color: #ff0000; font-weight: bold;\">End\u30d7\u30ed\u30d1\u30c6\u30a3<\/span>\u304c\u6d3b\u8e8d\u3057\u305d\u3046\u306a\u5834\u9762\u3067\u3059\u3002<\/p>\n<div class=\"linkcard\"><div class=\"lkc-external-wrap\"><a class=\"lkc-link no_icon\" href=\"https:\/\/tonari-it.com\/excel-vba-row-column\/\" target=\"_blank\" rel=\"external nofollow noopener\"><div class=\"lkc-card\"><div class=\"lkc-info\"><div class=\"lkc-favicon\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.google.com\/s2\/favicons?domain=tonari-it.com\" alt=\"\" width=\"16\" height=\"16\" \/><\/div><div class=\"lkc-domain\">\u3044\u3064\u3082\u96a3\u306bIT\u306e\u304a\u4ed5\u4e8b<\/div><\/div><div class=\"lkc-content\"><figure class=\"lkc-thumbnail\"><img decoding=\"async\" class=\"lkc-thumbnail-img\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/pz-linkcard\/cache\/5c03bc749912288e89d758780b86a0016b4d6e77293740bd3cd681638daef453.jpeg\" width=\"100px\" height=\"108px\" alt=\"\" \/><\/figure><div class=\"lkc-title\">\u3010\u30a8\u30af\u30bb\u30ebVBA\u3011\u8868\u306e\u6700\u7d42\u884c\u30fb\u6700\u7d42\u5217\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u306e\u307e\u3068\u3081<\/div><div class=\"lkc-url\" title=\"https:\/\/tonari-it.com\/excel-vba-row-column\/\">https:\/\/tonari-it.com\/excel-vba-row-column\/<\/div><div class=\"lkc-excerpt\">\u4eca\u56de\u306f\u3001\u8868\u306e\u6700\u7d42\u884c\u30fb\u6700\u7d42\u5217\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u3066\u3044\u304d\u307e\u3059\u3002\u8868\u306e\u6700\u7d42\u884c\u30fb\u6700\u7d42\u5217\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u306f\u3001\u8868\u306e\u7bc4\u56f2\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3068\u540c\u3058\u3088\u3046\u306b\u8907\u6570\u3042\u308a\u307e\u3059\u3002\u305d\u308c\u305e\u308c\u306e\u65b9\u6cd5\u306b\u7279\u5fb4\u304c\u3042\u308a\u3001\u8868\u306b\u3088\u3063\u3066\u4f7f\u3044\u5206\u3051\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u3053\u3067\u306f\uff13\u3064\u306e\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/div><\/div><div class=\"clear\"><\/div><\/div><\/a><\/div><\/div>\n<div class=\"linkcard\"><div class=\"lkc-external-wrap\"><a class=\"lkc-link no_icon\" href=\"https:\/\/www.relief.jp\/docs\/excel-vba-last-row-2.html\" target=\"_blank\" rel=\"external nofollow noopener\"><div class=\"lkc-card\"><div class=\"lkc-info\"><div class=\"lkc-favicon\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.google.com\/s2\/favicons?domain=www.relief.jp\" alt=\"\" width=\"16\" height=\"16\" \/><\/div><div class=\"lkc-domain\">www.relief.jp<\/div><\/div><div class=\"lkc-content\"><figure class=\"lkc-thumbnail\"><img decoding=\"async\" class=\"lkc-thumbnail-img\" src=\"https:\/\/s.wordpress.com\/mshots\/v1\/https%3A%2F%2Fwww.relief.jp%2Fdocs%2Fexcel-vba-last-row-2.html?w=100\" width=\"100px\" height=\"108px\" alt=\"\" \/><\/figure><div class=\"lkc-title\">\u6700\u7d42\u884c\u756a\u53f7\u3092\u53d6\u5f97\u3059\u308b\uff0d\u7a7a\u767d\u30bb\u30eb\u304c\u5b58\u5728\u3059\u308b\u5834\u5408:ExcelVBA Range\u30aa\u30d6\u30b8\u30a7\u30af\u30c8-End\u30d7...<\/div><div class=\"lkc-url\" title=\"https:\/\/www.relief.jp\/docs\/excel-vba-last-row-2.html\">https:\/\/www.relief.jp\/docs\/excel-vba-last-row-2.html<\/div><div class=\"lkc-excerpt\">Excel VBA\u3067\u3001\u7a7a\u767d\u30bb\u30eb\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\u306b\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u3001\u5b9a\u756a\u306e\u30b3\u30fc\u30c9\u300cCells(Rows.Count,<\/div><\/div><div class=\"clear\"><\/div><\/div><\/a><\/div><\/div>\n<p>\u3082\u308a\u3055\u3093\u306e\u8a18\u4e8b\u3067\u306f\u3001\u30bb\u30eb\u7bc4\u56f2\u3092\u914d\u5217\u3068\u3057\u3066\u53d6\u5f97\u3057\u305f\u5f8c\u3001\u9006\u5411\u304d\u306b\u30eb\u30fc\u30d7\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u7a7a\u767d\u30bb\u30eb\u3092\u610f\u8b58\u3057\u305f\u6700\u7d42\u884c\u30fb\u5217\u3092\u53d6\u5f97\u3059\u308b\u30b3\u30fc\u30c9\u3092\u7d39\u4ecb\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u306f\u3001Google Apps Script\u306b\u3082VBA\u306eEnd\u30d7\u30ed\u30d1\u30c6\u30a3\u7684\u306a\u51e6\u7406\u304c\u66f8\u3051\u308b\u30e1\u30bd\u30c3\u30c9\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u4eca\u56de\u306f\u305d\u3061\u3089\u3092\u7d39\u4ecb\u3057\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h4 class=\"style4a\">Selection.getNextDataRange\u30e1\u30bd\u30c3\u30c9<\/h4>\n<p>GAS\u306eSelection\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u306f\u3001\u30a2\u30af\u30c6\u30a3\u30d6\u306a\u30bb\u30eb\u7bc4\u56f2\u304b\u3089\u6307\u5b9a\u3057\u305f\u65b9\u5411\u306b\u62e1\u5f35\u3057\u305f\u30bb\u30eb\u7bc4\u56f2\u3092\u8fd4\u3059<a href=\"https:\/\/developers.google.com\/apps-script\/reference\/spreadsheet\/selection#getNextDataRange(Direction)\" title=\"Class Selection  |  Apps Script  |  Google Developers\" target=\"_blank\">getNextDataRange<\/a>\u30e1\u30bd\u30c3\u30c9\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u6587\u5b57\u3067\u66f8\u304f\u3068\u5206\u304b\u308a\u3065\u3089\u3044\u3067\u3059\u306d\u3002<br \/>\n\u8981\u3059\u308b\u306b\u3001<span style=\"color: #ff0000; font-weight: bold;\">\u30bb\u30eb\u3092\u9078\u629e\u3057\u305f\u72b6\u614b\u3067Ctrl + Shift + [\u65b9\u5411\u30ad\u30fc]\u3092\u62bc\u3057\u305f\u72b6\u614b\u306e\u30bb\u30eb\u3092\u53d6\u5f97<\/span>\u3067\u304d\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001VBA\u306eEnd\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u4f7f\u3063\u305f\u30b3\u30fc\u30c9\u306e\u3088\u3046\u306b\u6700\u7d42\u884c\u3084\u6700\u7d42\u5217\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">function myFunction() {\r\n  var col = 2;\r\n  var sheet = SpreadsheetApp.getActiveSheet();\r\n  var rng = sheet.getRange(1, col, sheet.getLastRow(), 1);\r\n  rng.activate(); \/\/\u6307\u5b9a\u3057\u305f\u5217\u9078\u629e\r\n  var lastRng = SpreadsheetApp.getSelection().getNextDataRange(SpreadsheetApp.Direction.UP);\r\n  lastRng.activate();\r\n  SpreadsheetApp.getUi().alert(lastRng.getLastRow());\r\n}\r\n\r\nfunction myFunction2() {\r\n  var row = 3;\r\n  var sheet = SpreadsheetApp.getActiveSheet();\r\n  var rng = sheet.getRange(row, 1, 1, sheet.getLastColumn());\r\n  rng.activate(); \/\/\u6307\u5b9a\u3057\u305f\u884c\u9078\u629e\r\n  var lastRng = SpreadsheetApp.getSelection().getNextDataRange(SpreadsheetApp.Direction.PREVIOUS);\r\n  lastRng.activate();\r\n  SpreadsheetApp.getUi().alert(lastRng.getLastColumn());\r\n}<\/pre>\n<p><a href=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_Spreadsheet_LastRow_LastColumn_01.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_Spreadsheet_LastRow_LastColumn_01.gif\" alt=\"\" width=\"803\" height=\"507\" class=\"alignnone size-full wp-image-11192\" \/><\/a><\/p>\n<p><span style=\"text-decoration: line-through;\">\u9078\u629e\u7bc4\u56f2\u304c\u5909\u308f\u3063\u3066\u3057\u307e\u3046\u306e\u304c\u96e3\u70b9\u3067\u3059\u304c\u3001\u6c17\u306b\u306a\u308b\u5834\u5408\u306f\u51e6\u7406\u524d\u306b\u9078\u629e\u7bc4\u56f2\u3092\u8a18\u61b6\u3057\u3066\u304a\u3044\u3066\u3001\u51e6\u7406\u5f8c\u306b\u623b\u305b\u3070\u826f\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #ff0000; font-weight: bold;\">2019\/2\/7 \u8ffd\u8a18\uff1a<\/span><br \/>\n\u3088\u304f\u8003\u3048\u305f\u3089\u3001<a href=\"https:\/\/developers.google.com\/apps-script\/reference\/spreadsheet\/range#getNextDataCell(Direction)\" title=\"Class Range  |  Apps Script  |  Google Developers\" target=\"_blank\">Range.getNextDataCell<\/a>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3048\u3070\u9078\u629e\u7bc4\u56f2\u3092\u5909\u66f4\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f&#x1f605;<\/p>\n<p><span style=\"color: #ff0000; font-weight: bold;\">2019\/2\/8 \u8ffd\u8a18\uff1a<\/span><br \/>\n\u30b3\u30fc\u30c9\u306b\u4e00\u90e8\u4e0d\u5177\u5408\u304c\u3042\u3063\u305f\u306e\u3067\u4fee\u6b63\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">function myFunction3() {\r\n  var col = 3;\r\n  var sheet = SpreadsheetApp.getActiveSheet();\r\n  var lastRng = sheet.getRange(sheet.getMaxRows(), col);\r\n  if (lastRng.isBlank() == true) {\r\n    lastRng = lastRng.getNextDataCell(SpreadsheetApp.Direction.UP);\r\n  }\r\n  lastRng.activate(); \/\/\u78ba\u8a8d\u7528\r\n  SpreadsheetApp.getUi().alert(lastRng.getLastRow());\r\n}\r\n\r\nfunction myFunction4() {\r\n  var row = 6;\r\n  var sheet = SpreadsheetApp.getActiveSheet();\r\n  var lastRng = sheet.getRange(row, sheet.getMaxColumns());\r\n  if (lastRng.isBlank() == true) {\r\n    lastRng = lastRng.getNextDataCell(SpreadsheetApp.Direction.PREVIOUS);\r\n  }\r\n  lastRng.activate(); \/\/\u78ba\u8a8d\u7528\r\n  SpreadsheetApp.getUi().alert(lastRng.getLastColumn());\r\n}<\/pre>\n<div id=\"single_banner_area2\" class=\"clearfix one_banner\">\n<div class=\"single_banner single_banner_left\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u8a18\u4e8b\u4e2d(\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u5e83\u544a\u30e6\u30cb\u30c3\u30c8) -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-7306936664602087\"\r\n     data-ad-slot=\"5429724765\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<div class=\"single_banner single_banner_right\">\n<a href=\"\" target=\"_blank\"><img decoding=\"async\" src=\"\" alt=\"\" title=\"\" \/><\/a>\n<\/div>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"\u3082\u308a(@moripro3)\u3055\u3093\u304c\u30d6\u30ed\u30b0\u3067\u3001Google Apps Script\u3067\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u6700\u7d42\u884c\u3068\u6700\u7d42\u5217\u3092\u53d6\u5f97\u3059\u308b\u30b3\u30fc\u30c9\u3092\u7d39\u4ecb\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u3002 Excel VBA\u3067\u51e6\u7406\u3059\u308b\u306a\u3089End\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u6d3b\u8e8d\u3057\u305d\u3046\u306a\u5834\u9762\u3067 [&hellip;]","protected":false},"author":1,"featured_media":7113,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[Re: \u3010GAS\u3011\u6307\u5b9a\u884c\u306e\u6700\u7d42\u5217\u756a\u53f7\u30fb\u6307\u5b9a\u5217\u306e\u6700\u7d42\u884c\u756a\u53f7\u3092\u53d6\u5f97\u3059\u308b]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[126],"tags":[],"class_list":["post-11191","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-google"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Google.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-2Uv","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11191"}],"version-history":[{"count":5,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11191\/revisions"}],"predecessor-version":[{"id":11197,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11191\/revisions\/11197"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7113"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}