gimme_this_gimme_that@yahoo.com
Guest
Fast way to make rows visible and invisible
My application has the following Sub which hides some rows and makes
others visible :
Is there a way to speed up this code somehow so that the cells are set
to visible and invisible in two instructions.
The code is real slow.
Public Sub RegionView(sheet As Worksheet, NavigationColumn As Long)
Dim i As Integer
Dim rowType As String
For i = STARTING_ROW_INDEX To MAXIMUM_ROW_INDEX
rowType = sheet.Cells(i, NavigationColumn).Value
If i < 2 Then
MsgBox rowType
End If
If "br_br" = rowType Then
sheet.Rows(CStr(i) + ":" + CStr(i)).EntireRow.Hidden = True
ElseIf "br_ta" = rowType Then
sheet.Rows(CStr(i) + ":" + CStr(i)).EntireRow.Hidden = True
ElseIf "rg_rg" = rowType Then
sheet.Rows(CStr(i) + ":" + CStr(i)).EntireRow.Hidden = True
ElseIf "rg_tr" = rowType Then
sheet.Rows(CStr(i) + ":" + CStr(i)).EntireRow.Hidden = False
Else
sheet.Rows(CStr(i) + ":" + CStr(i)).EntireRow.Hidden = False
End If
If i > MAXIMUM_ROW_INDEX Then
Exit For
End If
Next i
End Sub
Bookmarks