Thread: Auto Hide
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Davo[_3_] Davo[_3_] is offline
external usenet poster
 
Posts: 5
Default Auto Hide

Thanks for the reply

Sorry for my ignorance, I don't know where to enter this in. I assume this is VB


----- Mark Henri wrote: ----

I want to set up my Excel form so that when the user is finished enterin

the data, Excel hides columns/rows that don't have data in them. Fo
example, if I set it up for 10 rows, but the user only needs 4 rows, the
would hit a button (triggering a macro) and the 6 unused rows would b
hidden (or deleted.

Try something like this-

Private Sub HideRows(
Dim c As Rang
Application.ScreenUpdating = Fals
Application.Calculation = xlCalculationManua
For Each c In Range("a10:a20"
If c.Value = 0 The
c.EntireRow.Hidden = Tru
Els
c.EntireRow.Hidden = Fals
End I
Next
Application.Calculation = xlCalculationAutomati
Application.ScreenUpdating = Tru
End Su