Filtering data in excel without having to use 'Filter' -


i trying filter data in table based on month. has date cell. know can use filter option, don't want go through method decide month select. rather have more user friendly drop down box through select month , data shown of month only. know how implement this? open using macros , vba.

this example of technique........you have modify meet needs. have:

enter image description here

with data validation pull-down in cell c1. put event macro in worksheet code area:

private sub worksheet_change(byval target range)    dim t range, mn variant    set t = range("c1")    if intersect(t, target) nothing exit sub    mn = t.value    cells.entirerow.hidden = false    if mn = 0 or mn = "" exit sub     = 2 24       mnt = month(cells(i, 1).value)       if mnt <> mn          cells(i, 1).entirerow.hidden = true       end if    next end sub 

the macro monitor selection , display/hide rows accordingly.

because worksheet code, easy install , automatic use:

  1. right-click tab name near bottom of excel window
  2. select view code - brings vbe window
  3. paste stuff in , close vbe window

if have concerns, first try on trial worksheet.

if save workbook, macro saved it. if using version of excel later 2003, must save file .xlsm rather .xlsx

to remove macro:

  1. bring vbe windows above
  2. clear code out
  3. close vbe window

to learn more macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

and

http://msdn.microsoft.com/en-us/library/ee814735(v=office.14).aspx

to learn more event macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm

macros must enabled work!


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -