Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
RANGE EXCEL copy cell that meets criteria in a range confused Excel Worksheet Functions 3 March 27th 08 01:41 PM
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
Excel 2000 VBA - Set Print Range in dynamic range sub_pop[_5_] Excel Programming 2 July 27th 04 08:01 PM
adding reference-to-range control to excel range Nir Sfez Excel Programming 1 March 2nd 04 06:11 PM
Range.Formula and Range question using Excel Automation [email protected] Excel Programming 0 September 19th 03 04:53 AM


All times are GMT +1. The time now is 12:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"