excel if Range a1a2
Does any one know how to do this using vba.
I would like to have an if statement that is similar to this. If Range("C8") Range("C16") Then ActiveSheet.Shapes("Oval 806").Select Selection.ShapeRange.Line.Visible = False End If This will not work Please help... Thanks |
excel if Range a1a2
Just remove ShapeRange from your code.
Using a variable Sub try() Dim sh As Shape Set sh = ActiveSheet.Shapes("Oval 806") If Range("C8") Range("C16") Then sh.Line.Visible = False End If Set sh = Nothing End Sub Not using a variable Sub tryAgain() If Range("C8") Range("C16") Then ActiveSheet.Shapes("Oval 806") _ .Line.Visible = False End If End Sub Magoo wrote: Does any one know how to do this using vba. I would like to have an if statement that is similar to this. If Range("C8") Range("C16") Then ActiveSheet.Shapes("Oval 806").Select Selection.ShapeRange.Line.Visible = False End If This will not work Please help... Thanks |
excel if Range a1a2
Code works fine as-is for me...
Is your worksheet unprotected? Personally, I'd forego the selection and use With ActiveSheet If .Range("C8").Value .Range("C16").Value Then .Shapes("Oval 806").Line.Visible = False End If End With or even use a toggle (which would make the line visible again if C16<=C8) With ActiveSheet .Shapes("Oval 806").Line.Visible = _ .Range("C8").Value <= .Range("C16").Value End With In article .com, Magoo wrote: Does any one know how to do this using vba. I would like to have an if statement that is similar to this. If Range("C8") Range("C16") Then ActiveSheet.Shapes("Oval 806").Select Selection.ShapeRange.Line.Visible = False End If This will not work Please help... Thanks |
All times are GMT +1. The time now is 02:01 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com