DDRA Steampunk
New Member
- Joined
- Feb 10, 2017
- Messages
- 23
Solved right after initial post (by experimenting).
I need to autohide a crazy huge number of rows in one sheet, it currently has 9 sub tables (see Sample 2), and may need 11. Page not included because it's about 10 paper sheets long. Trying to get all arrays on one toggle button.
The new end product code is below.
I need to autohide a crazy huge number of rows in one sheet, it currently has 9 sub tables (see Sample 2), and may need 11. Page not included because it's about 10 paper sheets long. Trying to get all arrays on one toggle button.
The new end product code is below.
Code:
Public Sub ToggleButton1_Click()
Dim BeginRow As Variant
Dim EndRow As Variant
Dim ChkCol As Variant
Dim RowCnt As Long
Dim aryCnt As Long
BeginRow = Array("3", "115", "227", "339", "451", "563", "675", "787", "899")
EndRow = Array("110", "222", "334", "446", "558", "670", "782", "894", "1006")
ChkCol = Array("3", "3", "3", "3", "3", "3", "3", "3", "3")
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
If ToggleButton1.Value = False Then
For aryCnt = 0 To 8
ActiveSheet.Rows(BeginRow(aryCnt) & ":" & EndRow(aryCnt)).Hidden = False
Next aryCnt
Else
With ActiveSheet
For aryCnt = 0 To 8
For RowCnt = BeginRow(aryCnt) To EndRow(aryCnt)
If .Cells(RowCnt, CInt(ChkCol(aryCnt))).Value < 1 Then
.Cells(RowCnt, CInt(ChkCol(aryCnt))).EntireRow.Hidden = True
Else
.Cells(RowCnt, CInt(ChkCol(aryCnt))).EntireRow.Hidden = False
End If
Next RowCnt
Next aryCnt
.UsedRange.EntireColumn.AutoFit
End With
End If
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Last edited: