{"id":3148,"date":"2021-03-21T23:18:28","date_gmt":"2021-03-22T06:18:28","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=3148"},"modified":"2021-03-21T23:18:30","modified_gmt":"2021-03-22T06:18:30","slug":"how-to-select-from-active-cell-to-last-entry-in-excel-vba","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=3148","title":{"rendered":"How to Select From Active Cell to Last Entry in Excel VBA"},"content":{"rendered":"\n<p>This example illustrates the End property of the Range object in&nbsp;<strong>Excel VBA<\/strong>. We will use this property to select the range&nbsp;<strong>from the Active Cell to the last entry<\/strong>&nbsp;in a column.<\/p>\n\n\n\n<p>Situation:<\/p>\n\n\n\n<p>Some sales figures in column A. Assume that you will be adding more sales figures over time.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.excel-easy.com\/vba\/examples\/images\/from-active-cell-to-last-entry\/from-active-cell-to-last-entry-example.png\" alt=\"From Active Cell to Last Entry in Excel VBA\" title=\"From Active Cell to Last Entry in Excel VBA\"\/><\/figure>\n\n\n\n<p>Place a\u00a0command button\u00a0on your worksheet and add the following code lines:<\/p>\n\n\n\n<p>1. To select the last entry in a column, simply add the following code line:<\/p>\n\n\n\n<p><strong>Range(&#8220;A5&#8221;).End(xlDown).Select<\/strong><\/p>\n\n\n\n<p>Note: instead of Range(&#8220;A5&#8221;), you can also use Range(&#8220;A1&#8221;), Range(&#8220;A2&#8221;), etc. This code line is equivalent to pressing the END+DOWN ARROW.<\/p>\n\n\n\n<p>Result when you click the command button on the sheet:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.excel-easy.com\/vba\/examples\/images\/from-active-cell-to-last-entry\/last-entry.png\" alt=\"Last Entry\" title=\"Last Entry\"\/><\/figure>\n\n\n\n<p>2. To select the range from cell A5 to the last entry in the column, add the following code line:<\/p>\n\n\n\n<p><strong>Range(Range(&#8220;A5&#8221;), Range(&#8220;A5&#8221;).End(xlDown)).Select<\/strong><\/p>\n\n\n\n<p>Result when you click the command button on the sheet:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.excel-easy.com\/vba\/examples\/images\/from-active-cell-to-last-entry\/from-cell-A5-to-last-entry.png\" alt=\"From Cell A5 to Last Entry\" title=\"From Cell A5 to Last Entry\"\/><\/figure>\n\n\n\n<p>3. To select the range from the Active Cell to the last entry in the column, simply replace Range(&#8220;A5&#8221;) with <strong>ActiveCell.Range(ActiveCell, ActiveCell.End(xlDown)).Select<\/strong><\/p>\n\n\n\n<p>Result when you select cell A2 and click the command button on the sheet:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.excel-easy.com\/vba\/examples\/images\/from-active-cell-to-last-entry\/from-active-cell-to-last-entry.png\" alt=\"From Active Cell to Last Entry Result\" title=\"From Active Cell to Last Entry Result\"\/><\/figure>\n\n\n\n<p>Note: you can use the constants <strong>xlUp, xlToRight and xlToLeft <\/strong>to move in the other directions. This way you can select a range from the Active Cell to the last entry in a row.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This example illustrates the End property of the Range object in&nbsp;Excel VBA. We will use this property to select the range&nbsp;from the Active Cell to the last entry&nbsp;in a column. Situation: Some sales figures in column A. Assume that you will be adding more sales figures over time. Place a\u00a0command button\u00a0on your worksheet and add <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=3148\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10,18],"tags":[220,647],"class_list":["post-3148","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-microsoft-office","tag-excel-vba","tag-select-from-active-cell-to-last-entry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3148"}],"version-history":[{"count":1,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3148\/revisions"}],"predecessor-version":[{"id":3149,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3148\/revisions\/3149"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}