Hiding rows

Ninakitkat

New Member
Joined
Nov 17, 2023
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hello. I have a spreadsheet that is constantly being updated with new data that Ishare with others but need to hide the rows once that task is completed. I have a formula that ties all the rows to one subject but want them to hide once another cell is marked Y. Can someone help me figure out how to do that? This is what I'm working with:
1700249634790.png
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Welcome to the MrExcel board!

Assuming ..
  1. The "Y" values in column C are not the result of a formula
  2. There is at least 1 blank cell between each number in column B
.. then you could try this Worksheet_Change event code with a copy of your workbook. To implement ..
1. Right click the sheet name tab and choose "View Code".
2. Copy and Paste the code below into the main right hand pane that opens at step 1.
3. Close the Visual Basic window & test.
4. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm).

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim lr As Long
  
  If Target.CountLarge = 1 And Target.Column = 3 Then
    If UCase(Target.Value) = "Y" Then
      lr = Target.Offset(1, -1).End(xlDown).Row - 1
      If lr = Rows.Count - 1 Then lr = Target.Offset(1, 1).End(xlDown).Row
      Target.Resize(lr - Target.Row + 1).EntireRow.Hidden = True
    End If
  End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,956
Members
449,096
Latest member
Anshu121

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
Back
Top