Circling cells based on a value
Assuming that oval 2 is the one around j14 and oval 6 is the one around r14:
1 completely get rid of sub Hide_It()
2 not sure that you really want that target.count 1 question in there
3 use this (it only works on the active sheet anyway)
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$J$14" Then
If Range("j14") = "" Then ActiveSheet.Shapes("Oval 2").Visible = False
Else ActiveSheet.Shapes("Oval 2").Visible = True
End If
If Target.Address = "$R$14" Then
If Range("r14") = "" Then ActiveSheet.Shapes("Oval 6").Visible = False
Else ActiveSheet.Shapes("Oval 6").Visible = True
End If
End Sub
Please give me a green tick if this is a correct answer for you.
--
Allllen
" wrote:
What I'm trying to do is circle cells(J14 and R14) based on thier
value(empty cell no circle, occupied cell circled). I can only get one
circle to appear not two, and to make the circle dissappear I have to
manually run another macro. This is what I have so far, and is it
possible to all the code on the active sheet only?
for the workbook I have:
Sub Hide_It()
ActiveSheet.Shapes("Oval 2").Visible = False
ActiveSheet.Shapes("Oval 6").Visible = False
End Sub
and for the Active sheet I have:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Count 1 Then Exit Sub
With Range("j14")
If .Value 0 Then
ActiveSheet.Shapes("Oval 2").Visible = True
End If
End With
End Sub
any help would be greatful, thanks
|