Hi All,
I'm looking to simplify my macro which is triggered when a value within a drop down changes. The macro then finds all rows within a table that do not contain that value that matches the drop down and calls a macro to hide rows that do not match. As this process contains a few steps in it, it tends to cause the table to flicker momentarily whilst it filters the table view and I can assume that it has to do with the length of the macro process. My question is, it there any way of simplifying the macro below so that there's fewer steps and hopefully less 'flicker' when the macro is triggered?
Its a superficial thing to ask but I know the users will wonder if their laptops are having a melt-down for some reason.
Here's my code
To clarify, I want a way to simplify the above process so that it doesnt take as long to execute the filtering of the data within a table and hopefully reduce the flickering that occurs when the macro is triggered and executing the action.
Many thanks,
Jeevz
I'm looking to simplify my macro which is triggered when a value within a drop down changes. The macro then finds all rows within a table that do not contain that value that matches the drop down and calls a macro to hide rows that do not match. As this process contains a few steps in it, it tends to cause the table to flicker momentarily whilst it filters the table view and I can assume that it has to do with the length of the macro process. My question is, it there any way of simplifying the macro below so that there's fewer steps and hopefully less 'flicker' when the macro is triggered?
Its a superficial thing to ask but I know the users will wonder if their laptops are having a melt-down for some reason.
Here's my code
VBA Code:
Private Sub worksheet_change(ByVal target As Range)
Set target = Range("A2")
If target.Value = "Location 1" Then
Call HideRows
End If
If target.Value = "Location 2" Then
Call HideRows
End If
If target.Value = "Location 3" Then
Call HideRows
End If
If target.Value = "Location 4" Then
Call HideRows
End If
If target.Value = "Location 5" Then
Call HideRows
End If
If target.Value = "Location 6" Then
Call HideRows
End If
If target.Value = "Location 7" Then
'The macro call out below hides all rows in a hidden helper column in the table which have the value of '0'.
Call HideRows
End If
End Sub
To clarify, I want a way to simplify the above process so that it doesnt take as long to execute the filtering of the data within a table and hopefully reduce the flickering that occurs when the macro is triggered and executing the action.
Many thanks,
Jeevz