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 ipython in Cloudera VM using pip

install postgreSQL in ubuntu 16.04

Install MYSQL 5.6 in ubuntu 12.04/14.04 and set password and remote access