Hi
I have a macro on a sheet to hide all empty rows based on the values of cells A55 to A215. The value comes from a droplist that is filled by the users. If the value “1” appears, the row is visible, if nothing appears, the row should hide automatically.
The macro is working if I change the value manually in column A ("1" or empty) but the fact that the value comes from a Vlookup formula linked to a drop list (H29:H36) caused some problems... So according to the selection in the drop list, the value changes from empty to "1" and this must decide if the row is hide or not. The problem is when I change the value from the droplist, nothing happen. Do you think you could find out why?
Thanks,
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A55:A255")) Is Nothing Then
Call HideRows2
End If
End Sub
Sub HideRows2()
Dim LR As Long, i As Long
LR = Cells.Find(What:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlFormulas).Row
For i = 55 To LR
If Cells(i, 1) = "" Then Rows(i).EntireRow.Hidden = True
If Cells(i, 1).HasFormula And Cells(i, 1) = "" Then
Rows(i).EntireRow.Hidden = True
ElseIf Cells(i, 1).HasFormula And Cells(i, 1) = 0 Then
Rows(i).EntireRow.Hidden = True
End If
Next i
End Sub
Dropbox link:
https://dl.dropbox.com/u/93601544/TE...WS%20EXTR.xlsm
Bookmarks