Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Filter Rows Question

  Asked By: Bakir    Date: Dec 16    Category: MS Office    Views: 539
  

We have a automatic spreadsheet generated by our scheduling program which lists
the Employee's Name in Column A and then the details of his work/address/job
type in the next rows and down and columns across.

What i'm trying to do is filter by employee name but show the rows below until
the next employee name.

Any ideas?

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Bama Cohen     Answered On: Dec 16

I would add (duplicate) the Employee name for every
applicable Row but use conditional formatting to hide it (Font color =
Background).

The Auto Filter will still find all rows  but only the first Employee
name in Column A would show.

Set Conditional Format by selecting all of Column B (assuming first row
is 1) and entering =B2=B1

 
Answer #2    Answered By: Hadil Khan     Answered On: Dec 16

Copy this code into your sheet code
this after you filter  your employee
double click on the cell to open the hidden rows  below.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
LastRow = 100
CurrentRow = ActiveCell.Row + 1 'get the current row your employee is
showing
While Cells(CurrentRow, 1) = Empty And CurrentRow < LastRow + 1
Cells(CurrentRow, 1).EntireRow.Hidden = False 'unhide all the row
between the employee you want to see and the next one
CurrentRow = CurrentRow + 1
Wend
End Sub

 
Answer #3    Answered By: Dale Jones     Answered On: Dec 16

This works well but can this be done just by auto filtering the employee column?

 
Answer #4    Answered By: Nicolas Costa     Answered On: Dec 16

I haven't found a way to trigger the macro with just filtering. I was hoping
someone else could chime in and help us out.

The only way I can see it working is use a pull down instead of filter. When a
new name is selected in the pull down a macro is ran that includes code to
filter (or code to find) by the name selected and then the code I gave you.

 
Didn't find what you were looking for? Find more on Filter Rows Question Or get search suggestion and latest updates.




Tagged: