Automatically Hide Row on Another Worsheet

Chili14

New Member
Joined
Dec 21, 2016
Messages
8
Could someone help me write a script that will automatically hide rows on a "Summary" worksheet base on selections made from a "List" worksheet. The calculated values in column A ("QTY") on the "Summary" worksheet are "" when not selected from the "List" worksheet. I found some script that I modified to work looking at the calculated value "" but it only runs when selecting a cell or hitting Enter when in the "Summary" worksheet. Ideally I would like the "Summary" Worksheet to update as soon as the selection is made on the "List" worksheet so when viewing in split screen mode the "Summary" worksheet is updated automatically, without having to select a cell or hitting enter. Is this possible?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
Dim LastRow As Long
LastRow = Cells.Find("""", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Dim cell As Range
ActiveSheet.UsedRange.Rows.EntireRow.Hidden = False
For Each cell In Range("a4:a" & LastRow)
If cell.Value = "" Then
cell.EntireRow.Hidden = True
End If
Next cell
Application.ScreenUpdating = True
End Sub
 
It works for some combinations but not all. As one example - If all items are checked on the "List" except "Cleaning Oven" and "Ultrasonic it will only hide rows if the macro is run 2x, or every other time. Very strange. There are other combinations that behave the same.
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
I changed the Range property to UsedRange property to search for the last row and it seems to be working now.

bottomA = desWS.UsedRange.Rows(desWS.UsedRange.Rows.Count).Row

I can't thank you enough.
 
Upvote 0

Forum statistics

Threads
1,216,114
Messages
6,128,910
Members
449,478
Latest member
Davenil

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