Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / December 2007

Tip: Looking for answers? Try searching our database.

automatically hiding a cell when value changes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
swiftcode - 06 Dec 2007 18:36 GMT
Hi all,

I have a problem on hiding a row when the value of a cell changes.

The following macro which works if i manualy input a zero value into the
cell, but when the cell is a formula and the result is zero, it doesent work
anymore.

Can anybody please help.

Thanks in advance.

the code is as follows:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$7" Then
If Target <= 0 Then
Cells(7, 3).EntireRow.Hidden = True
Else
Cells(7, 3).EntireRow.Hidden = False
End If
End If
End Sub
Gary''s Student - 06 Dec 2007 18:57 GMT
You need the Calculate Event, not the Change Event.
Signature

Gary''s Student - gsnu200760

> Hi all,
>
[quoted text clipped - 19 lines]
> End If
> End Sub
swiftcode - 07 Dec 2007 09:44 GMT
Hi Gary,

Thanks for your help. COuld you show me where to change this event?

> You need the Calculate Event, not the Change Event.
>
[quoted text clipped - 21 lines]
> > End If
> > End Sub
Gary''s Student - 07 Dec 2007 10:21 GMT
Private Sub Worksheet_Calculate()
If Range("C7").Value <= 0 Then
   Cells(7, 3).EntireRow.Hidden = True
Else
   Cells(7, 3).EntireRow.Hidden = False
End If
End Sub

This replaces your other macro
Signature

Gary''s Student - gsnu200760

> Hi Gary,
>
[quoted text clipped - 25 lines]
> > > End If
> > > End Sub
swiftcode - 09 Dec 2007 08:07 GMT
Hi Gary,

It works great. Thank you very much for your help.

Rgds
SC

> Private Sub Worksheet_Calculate()
> If Range("C7").Value <= 0 Then
[quoted text clipped - 35 lines]
> > > > End If
> > > > End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.