Microsoft Excel - VBA to hide rows in a table that do not fall in a date range to switch between years

Asked By Nick Crane on 07-Sep-16 10:08 AM

Hi There,


Need some help with Excel.  I am not too familiar with VBA, but I get the idea (somewhat).


I have a table where Column A has an effective date (1/1/2016, 2/1/2016, etc.).  With the new year coming, I need to start entering 2017 effective dates.  While I still need the 2016 data, I want to be able to switch between years.


I have two cells (L1 - shows 1/1/2016; M1 shows 12/31/2016).  I can change these out between years, but is there a way that triggers the rows in my table to hide if the dates in column A do not fall within the range from cells L1 and M1?


Or is there an easier way to hide the year that I am not working on?


I can always create a new workbook, but it would be great to have all the data on one workbook.


I hope this was clear.  Can someone walk me through how to accomplish my goal?


Thank you in advance.

Robbe Morris replied to Nick Crane on 07-Sep-16 11:35 AM
I would try using the Macro Recorder feature in Excel to capture you doing some of these steps manually.  It will generate some of the key VBA code for you to modify and ultimately use.
Harry Boughen replied to Nick Crane on 28-Sep-16 12:02 AM
Hello Nick,

I realise this question is a bit old by this.  If you haven't sorted it, have a read here -

http://www.mrexcel.com/forum/excel-questions/511645-hide-row-based-conditional-formatting.html

This should get you going if you still need a hand.

Harry