Auto Hide Rows

ExcelRoy

Well-known Member
Joined
Oct 2, 2006
Messages
2,540
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am looking for some code to implement into a sheet

I would like to auto hide a row if in column "H" it shows "Inactive"

This would be within the ranges A1:H100

Many Thanks
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Also try a slight modification...

There could be a space at the end of the string...

Code:
Private Sub Worksheet_Calculate()
Dim i As Long
Application.ScreenUpdating = False
For i = 1 To 100
    Rows(i).Hidden = UCase(Trim(Range("H" & i).Value)) = "INACTIVE"
Next i
Application.ScreenUpdating = True
End Sub
 
Upvote 0
sorry guys, neither works?

is there a setting that must be on?
 
Upvote 0
1) Macros must be enabled.

2) Events must be enabled. In the code window press CTRL + G to open the Immediate Window and in that window type or paste

Application.EnableEvents=True

then press Enter.

The code works here by the way.
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,822
Members
452,946
Latest member
JoseDavid

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