I've recently started using excel, I've never used macros/vba before. Let's just say I haven't got a clue as to how to construct them.
My case is the following: I have a list with date over several years, Column A10 downwards contain the year (every row with info about 2015 is designated 2015 in the according A Row). I wish to auto hide rows and only show rows with the a year of my choice (A1 contains the year I want to view, contains a dropdown list).
One final important thing, I still want to be able to add more info underneath lowest row containing values. This is the reason Vlookup to different sheets wouldn't work out.
The code I've found(Literally found) to be working =
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target.Cells.Count = 1 Then
Application.ScreenUpdating = False
Range("A10:A100").EntireRow.Hidden = False
Dim mgrList As Range
Set mgrList = Range(Range("A10"), Range("A10").End(xlDown))
Dim mgrCheck As Range
For Each mgrCheck In mgrList
mgrCheck.EntireRow.Hidden = mgrCheck <> Target
Next
End If
End Sub
The only problem is, it takes very very long to update the rows when the value in cell A1 is changed. Even for just Range A10:A100 it will take several minutes, whilst I need a minimum range of A10:A1000.
Can you gods tell guide me to a way for this not to take this long?
Bookmarks