VBA excel macro - hide rows with 0 value between 2 rows with specific value



The trick is to use & to get the Range.


Sub HideRows()
'
' HideRows Macro
'
    Dim FoundCellS As Excel.Range
    Dim FoundCellE As Excel.Range
    Dim iRowS As Integer
    Dim iRowE As Integer
    
    
    Set FoundCellS = Range("sheetname!A:A").Find(what:="string1", lookat:=xlWhole)
    Set FoundCellE = Range("sheetname!A:A").Find(what:="string2", lookat:=xlWhole)
    iRowS = FoundCellS.Row
    iRowE = FoundCellE.Row
    
    
    For Each c In Worksheets("DailyReport").Range("B" & iRowS & ":B" & iRowE)
        If c.Value < 10 And c.Value <> "" Then Rows(c.Row).EntireRow.Hidden = True
    Next
    
End Sub

Comments

Popular posts from this blog

install postgreSQL in ubuntu 16.04

timestamp with 16, 13 and 10 digits to Qlik date

install ipython in Cloudera VM using pip