End goal:
To enter a numeric value in a cell, and according to the value, it will hide all rows based on different values in a set column.
Example:
Enter 4 in cell B2 and it will hide all rows which contain values "AB5, AB6, AB7, AB8" in column P.
What i've tried:
VBA code, but i can only get it to work through defining which rows I want to hide, which is a problem as I have over 16000 rows of data. I'd like it to work dynamically dependant on the value in column P:
Conditional formatting may be a solution I haven't looked into yet, but really i'd to be able to type in a number and I see the information I need, enabling me to copy this to another sheet/document. I'd really appreciate any pointers on the best way of doing this, thanks.
To enter a numeric value in a cell, and according to the value, it will hide all rows based on different values in a set column.
Example:
Enter 4 in cell B2 and it will hide all rows which contain values "AB5, AB6, AB7, AB8" in column P.
What i've tried:
VBA code, but i can only get it to work through defining which rows I want to hide, which is a problem as I have over 16000 rows of data. I'd like it to work dynamically dependant on the value in column P:
Code:
[TABLE="width: 65"]
<tbody>[TR]
[TD]Sub worksheet_change(ByVal target As Range)[/TD]
[/TR]
[TR]
[TD]If Not Intersect(target, Range("B2")) Is Nothing Then[/TD]
[/TR]
[TR]
[TD] ActiveSheet.Rows("10:20000").EntireRow.Hidden = False[/TD]
[/TR]
[TR]
[TD] If target = 1 Then[/TD]
[/TR]
[TR]
[TD] ActiveSheet.Rows("12:18").EntireRow.Hidden = True[/TD]
[/TR]
[TR]
[TD] ElseIf target = 2 Then[/TD]
[/TR]
[TR]
[TD] ActiveSheet.Rows("13:18").EntireRow.Hidden = True[/TD]
[/TR]
[TR]
[TD] ElseIf target = 3 Then[/TD]
[/TR]
[TR]
[TD] ActiveSheet.Rows("14:18").EntireRow.Hidden = True[/TD]
[/TR]
[TR]
[TD] ElseIf target = 4 Then[/TD]
[/TR]
[TR]
[TD] ActiveSheet.Rows("15:18").EntireRow.Hidden = True[/TD]
[/TR]
[TR]
[TD] ElseIf target = 5 Then[/TD]
[/TR]
[TR]
[TD] ActiveSheet.Rows("16:18").EntireRow.Hidden = True[/TD]
[/TR]
[TR]
[TD] ElseIf target = 6 Then[/TD]
[/TR]
[TR]
[TD] ActiveSheet.Rows("17:18").EntireRow.Hidden = True[/TD]
[/TR]
[TR]
[TD] ElseIf target = 7 Then[/TD]
[/TR]
[TR]
[TD] End If[/TD]
[/TR]
</tbody>[/TABLE]
Conditional formatting may be a solution I haven't looked into yet, but really i'd to be able to type in a number and I see the information I need, enabling me to copy this to another sheet/document. I'd really appreciate any pointers on the best way of doing this, thanks.