Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
RANGE EXCEL copy cell that meets criteria in a range | Excel Worksheet Functions | |||
Excel Addin:Setting the range to the Excel.Range object range prop | Excel Worksheet Functions | |||
Excel 2000 VBA - Set Print Range in dynamic range | Excel Programming | |||
adding reference-to-range control to excel range | Excel Programming | |||
Range.Formula and Range question using Excel Automation | Excel Programming |