Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide Rows based on value of a cell Gordon[_2_] Excel Programming 2 September 25th 08 01:10 PM
Hide/Show Rows based on Cell Value with Data Validation Shelly Excel Programming 3 January 4th 08 11:01 PM
hide rows based on cell value dummster New Users to Excel 1 February 15th 06 11:37 PM
hide rows based on value in cell dummster Excel Discussion (Misc queries) 0 February 15th 06 03:27 PM
Macro to hide rows based on a zero value in a particular cell Peter Excel Programming 2 July 29th 04 03:19 AM


All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"