Hiding rows after cell entry

XrayLemi

Board Regular
Joined
Aug 1, 2018
Messages
87
Office Version
  1. 365
Platform
  1. Windows
Hello everyone. Hope you are all well and safe.

Here is my dilemma. I need to hide rows after a value is entered. All the code I have seen posted here will hide every row after a cell entry is made. What I need is, if I add a date in column "E" next to the name Bill like in the picture, I want every row with the name Bill in column "D" to be hidden EXCEPT the row with the date. Later if I add a date in column "E" next to the name Gus, all the rows with Gus, except the row with the date, will be hidden. Once the date is added in column "E" that name will never be added to the list again. So, I won't have to worry about hiding future entries with that name.

The name here is generic. There will be first, last and maybe middle names as well. I don't know if it matters, but all the entries in columns A-D are auto filled by entries in other workbooks. the only manual entry is the date in column "E". Hope this

Thank you in advance,
Jim
 

Attachments

  • Name List.png
    Name List.png
    107.3 KB · Views: 7

Some videos you may like

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,411
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Will the col E cells for a given name always be empty except for the one row you don't want hidden?
 

Osvaldo Palmeiro

Well-known Member
Joined
Feb 24, 2009
Messages
625
Office Version
  1. 365
Platform
  1. Windows
Please, try this:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
 Dim LR As Long, NP As Range
  If Target.Count > 1 Then Exit Sub
  If Target.Column <> 5 Or Target.Value = "" Or Target.Offset(, -1).Value = "" Then Exit Sub
  LR = Cells(Rows.Count, 4).End(3).Row
  For Each NP In Range("D2:D" & LR).SpecialCells(xlVisible)
   Rows(NP.Row).Hidden = Cells(NP.Row, 4) = Target.Offset(, -1).Value And NP.Row <> Target.Row
  Next NP
End Sub
 
Solution

XrayLemi

Board Regular
Joined
Aug 1, 2018
Messages
87
Office Version
  1. 365
Platform
  1. Windows
This works perfectly! Thank you so much!
 

Watch MrExcel Video

Forum statistics

Threads
1,127,107
Messages
5,622,782
Members
415,927
Latest member
vedasinternational

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top