{"id":3258,"date":"2021-04-23T09:20:32","date_gmt":"2021-04-23T16:20:32","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=3258"},"modified":"2021-04-24T10:04:12","modified_gmt":"2021-04-24T17:04:12","slug":"excel-vba-auto-filter-based-on-values-of-another-cells","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=3258","title":{"rendered":"Excel VBA Auto-filter Based on Values of Another Cells"},"content":{"rendered":"\n<p>I and was trying to filter the data based a couple of cell values. Finally, I figured it out.<\/p>\n\n\n\n<p>Below, please see my sample. Filler Sheet &#8220;Trans&#8221; based on the values of C3, C5 and C6  from Sheet &#8221; Reports&#8221;.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Sheets(\"Report\").Select\nRange(\"C4\").Select\nstore = ActiveCell.Value\nRange(\"C5\").Select\nsdate = ActiveCell.Value\nRange(\"C6\").Select\nendate = ActiveCell.Value\n\nSheets(\"Trans\").Select\nLastRow = Cells(Rows.Count, 1).End(xlUp).Row\nIf (ActiveSheet.AutoFilterMode And ActiveSheet.FilterMode) Or ActiveSheet.FilterMode Then\n  ActiveSheet.ShowAllData\nEnd If\n\nRange(\"A1:L\" &amp; LastRow).Select\nSelection.AutoFilter\nSelection.AutoFilter Field:=1, Criteria1:= _\n    store\nSelection.AutoFilter Field:=2, Criteria1:= _\n\"&gt;=\" &amp; sdate, Operator:=xlAnd, Criteria2:=\"&lt;=\" &amp; endate\n\nRange(\"A1:L\" &amp; LastRow).Select\nSelection.SpecialCells(xlCellTypeVisible).Select\nSelection.Copy\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"669\" height=\"227\" src=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2021\/04\/image-2.png\" alt=\"\" class=\"wp-image-3259\" srcset=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2021\/04\/image-2.png 669w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2021\/04\/image-2-300x102.png 300w\" sizes=\"(max-width: 669px) 100vw, 669px\" \/><figcaption>Sheet &#8220;Reports&#8221;<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"662\" height=\"373\" src=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2021\/04\/image-6.png\" alt=\"\" class=\"wp-image-3275\" srcset=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2021\/04\/image-6.png 662w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2021\/04\/image-6-300x169.png 300w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2021\/04\/image-6-128x72.png 128w\" sizes=\"(max-width: 662px) 100vw, 662px\" \/><figcaption>Sheet &#8220;Trans&#8221;<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>I and was trying to filter the data based a couple of cell values. Finally, I figured it out. Below, please see my sample. Filler Sheet &#8220;Trans&#8221; based on the values of C3, C5 and C6 from Sheet &#8221; Reports&#8221;.<\/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":[694],"class_list":["post-3258","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-microsoft-office","tag-excel-vba-auto-filter"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3258","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=3258"}],"version-history":[{"count":3,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3258\/revisions"}],"predecessor-version":[{"id":3276,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3258\/revisions\/3276"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}