View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Hide Autoshape based on Cell Value

I see from your recent reply to Rick that E5 is a formula cell. As long as
it only refers to cells on the same sheet, in the code below change.

If Not Intersect(Target, cel) Is Nothing Then

to
If Not Intersect(Target, cel.Precedents) Is Nothing Then

If the formula refers to cell(s) on (an)other sheet(s), put a similar
formula in a helper cell on the same sheet and link E1 to that.

Regards,
Peter T

"Peter T" <peter_t@discussions wrote in message
...
One more -

Private Sub Worksheet_Change(ByVal Target As Range)
Dim bVis As Boolean
Dim cel As Range
On errExit GoTo errExit
Set cel = Range("E5")
If Not Intersect(Target, cel) Is Nothing Then
bVis = Not cel = 0
With ActiveSheet.Shapes("change")
If .Visible < bVis Then .Visible = bVis
End With
End If
errExit:
End Sub

Caters for user changing multiple cells that include E5 without it
necessarily being the active cell, eg paste or delete a block. Then only
change visibility if needs to retain Undo where possible.

Regards,
Peter T

"tomic" wrote in message
...
I've tried several things, based on some other posts here, but haven't

been
successful in getting this to work.

I would like to hide an autoshape, named "Change" based on the value of

a
cell "E5" in a worksheet named "Flow Rates". Basically, if E5 = 0, I

don't
want the user to see this autoshape.

Any help would be appreciated. I have a feeling this is fairly simple,

but
as my VB knowledge is fairly limited, I haven't been able to figure it

out.

Thanks.