Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide rows based on cell data
My spreadsheet shows 6 different department's file records. Colum J
specifies Dept A, Dept B, Dept C, etc. I'd like to create a macro button for each Dept that would show just thier records and hide the others, but I don't know how. Can anyone help? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide rows based on cell data
On Jul 27, 1:56*pm, Munchkin
wrote: My spreadsheet shows 6 different department's file records. *Colum J specifies Dept A, Dept B, Dept C, etc. * I'd like to create a macro button for each Dept that would show just thier records and hide the others, but I don't know how. *Can anyone help? Hi Munchkin, why not use Excel's Auto Filter? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide rows based on cell data
have you tried the Autofilter? that's exactly what it can do for you
"Munchkin" wrote in message ... My spreadsheet shows 6 different department's file records. Colum J specifies Dept A, Dept B, Dept C, etc. I'd like to create a macro button for each Dept that would show just thier records and hide the others, but I don't know how. Can anyone help? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide rows based on cell data
I use autofilter all the time, but the people using this spreadsheet are not
familiar with Excel & would not be receptive to learning how to use Autofilter. My worksheet has various macros assigned to buttons to make this super easy. I tried writing a macro that used autofilter, but when I tried to run it I got an error message, so I thought you could not use autofilter in a macro. I'm completely self taught at this stuff....so I'm an amature at this stuff. Can you use autofilter in a macro? "Patrick Molloy" wrote: have you tried the Autofilter? that's exactly what it can do for you "Munchkin" wrote in message ... My spreadsheet shows 6 different department's file records. Colum J specifies Dept A, Dept B, Dept C, etc. I'd like to create a macro button for each Dept that would show just thier records and hide the others, but I don't know how. Can anyone help? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide rows based on cell data
You can run autofilter from a macro.
Instead of "writing" the macro, try using the macro recorder. When you have the code for that, you can refine it to event code which runs when users select a Dept from a Data Validation dropdown list. Gord Dibben MS Excel MVP On Tue, 28 Jul 2009 12:11:02 -0700, Munchkin wrote: I use autofilter all the time, but the people using this spreadsheet are not familiar with Excel & would not be receptive to learning how to use Autofilter. My worksheet has various macros assigned to buttons to make this super easy. I tried writing a macro that used autofilter, but when I tried to run it I got an error message, so I thought you could not use autofilter in a macro. I'm completely self taught at this stuff....so I'm an amature at this stuff. Can you use autofilter in a macro? "Patrick Molloy" wrote: have you tried the Autofilter? that's exactly what it can do for you "Munchkin" wrote in message ... My spreadsheet shows 6 different department's file records. Colum J specifies Dept A, Dept B, Dept C, etc. I'd like to create a macro button for each Dept that would show just thier records and hide the others, but I don't know how. Can anyone help? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide rows based on cell data
Hi Munchkin,
This should work for you. Here's the code for button A. Just duplicate it to address b, c, and d. It is case sensitive. Have fun, Ron Sub HiddenRows() Dim RowNdx As Long Dim LastRow As Long Application.ScreenUpdating = False ActiveSheet.Rows.Hidden = False LastRow = ActiveSheet.Cells(Rows.Count, "J").End(xlUp).Row For RowNdx = LastRow To 1 Step -1 If Cells(RowNdx, "J") = "dept b" Then Rows(RowNdx).Hidden = True End If If Cells(RowNdx, "J") = "dept c" Then Rows(RowNdx).Hidden = True End If If Cells(RowNdx, "J") = "dept d" Then Rows(RowNdx).Hidden = True End If Next RowNdx Range("A1").Select End Sub On Jul 28, 12:34*pm, Gord Dibben <gorddibbATshawDOTca wrote: You can run autofilter from a macro. Instead of "writing" the macro, try using the macro recorder. When you have the code for that, you can refine it to event code which runs when users select a Dept from a Data Validation dropdown list. Gord Dibben *MS Excel MVP On Tue, 28 Jul 2009 12:11:02 -0700, Munchkin wrote: I use autofilter all the time, but the people using this spreadsheet are not familiar with Excel & would not be receptive to learning how to use Autofilter. *My worksheet has various macros assigned to buttons to make this super easy. *I tried writing a macro that used autofilter, but when I tried to run it I got an error message, so I thought you could not use autofilter in a macro. I'm completely self taught at this stuff....so I'm an amature at this stuff. Can you use autofilter in a macro? "Patrick Molloy" wrote: have you tried the Autofilter? that's exactly what it can do for you "Munchkin" wrote in message ... My spreadsheet shows 6 different department's file records. *Colum J specifies Dept A, Dept B, Dept C, etc. * I'd like to create a macro button for each Dept that would show just thier records and hide the others, but I don't know how. *Can anyone help?- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Hide Rows based on value of a cell | Excel Programming | |||
Hide/Show Rows based on Cell Value with Data Validation | Excel Programming | |||
hide rows based on cell value | New Users to Excel | |||
hide rows based on value in cell | Excel Discussion (Misc queries) | |||
Macro to hide rows based on a zero value in a particular cell | Excel Programming |