Results 1 to 4 of 4

Thread: RESOLVED[Colors]

  1. #1

    Thread Starter
    Addicted Member Fonty's Avatar
    Join Date
    May 2006
    Location
    New York
    Posts
    173

    Resolved RESOLVED[Colors]

    To fill some shape with white color I use the following intructions:
    VB Code:
    1. ActiveSheet.Shapes(i).Select
    2. Selection.ShapeRange.Fill.Solid
    3. Selection.ShapeRange.Fill.ForeColor.SchemeColor = 1
    However I'm unable to run something like
    VB Code:
    1. ActiveSheet.Shapes(i).Select
    2. If Selection.ShapeRange.SchemeColor = 1 Then
    3. GoTo end
    4. Else
    5. Selection.ShapeRange.Fill.Solid
    6. Selection.ShapeRange.Fill.ForeColor.SchemeColor = 1
    7. End If
    8. End:
    How can I write a condition on the color of a shape?
    Last edited by Fonty; May 26th, 2006 at 01:02 PM.

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Colors

    If Selection.ShapeRange.Fill.ForeColor.SchemeColor = 1 then

    and DO NOT USE END

    actually rewrite that so u dont need the goto.. try to avoid goto's unless u HAVE to use it

    VB Code:
    1. ActiveSheet.Shapes(I).Select
    2.     If Selection.ShapeRange.Fill.ForeColor.SchemeColor  <> 1 Then
    3.         Selection.ShapeRange.Fill.Solid
    4.         Selection.ShapeRange.Fill.ForeColor.SchemeColor = 1
    5.     End If
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Colors

    Quote Originally Posted by Static
    and DO NOT USE END
    In this case, End appears to be a label rather then the use of that function that we will not mention , and this appears to be Excel VBA code.

    Moved to Office Development

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Colors

    I know it was just a lable.... but I figured its best to just avoid it all together.. and try to avoid the goto as well
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width