Auto Hide Rows & Columns

mathewmunna Posts 27 Registration date Tuesday November 18, 2014 Status Member Last seen May 21, 2015 - Dec 11, 2014 at 01:04 AM

i have a worksheet with many formulas in it. i use bellow code for auto hide rows and columns when a a cell in that column or row is 0 or empty.. the autohide on rows works perfectly when i enter value in that perticular cell. but column is not hiding or unhiding automatically unless i unhide all and run the code again. here is the code bellow i am using... please help me if any modification can be done for auto hide without unhiding and running the code again..

Dim R As Range, C As Range
Set R = Range("K1:K14")
Application.ScreenUpdating = False
For Each C In R
If Len(C.Text) = 0 Then
C.EntireRow.Hidden = True
C.EntireRow.Hidden = False
End If
Next C
Application.ScreenUpdating = True
Dim S As Range, d As Range
Set S = Range("A15:J15")
Application.ScreenUpdating = False
For Each d In S
If Len(d.Text) = 0 Then
d.EntireColumn.Hidden = True
d.EntireColumn.Hidden = False
End If
Next d
Application.ScreenUpdating = True
End Sub