Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jun 2002
    Location
    Nottingham, Nottinghamshire, United Kingdom
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    xlColorIndexNone (Excel2003)

    Why does the following line colour the cell light blue when it should take away any existing colour?

    Selection.Interior.Color = xlColorIndexNone

    I'm obviously doing something wrong.

    Also, why doesn't Excel give me help in writing code like Access; it would be nice if the VBA editor gave lists of acceptable syntax and autocompletion. I'm fresh to Excel VBA but competent in Access VBA.

    David

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: xlColorIndexNone (Excel2003)

    1) Try

    Selection.Interior.ColorIndex = xlColorIndexNone

    Interior has a property Color that can be set to an RGB color such as vbRed or RGB(128, 192, 255), and also a property ColorIndex that can be set to a value between 1 and 56 or to xlColorIndexNone or xlColorIndexAutomatic. You shouldn't use xlColorIndexNone with the Color property.

    2) Selection is an ambiguous object: it could refer to a cell range or to a chart or to a graphic object. That's why IntelliSense doesn't work for it. It does work for ActiveCell, for example.

  3. #3
    3 Star Lounger
    Join Date
    Jun 2002
    Location
    Nottingham, Nottinghamshire, United Kingdom
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: xlColorIndexNone (Excel2003)

    Thanks Hans. Exactly what I wanted.
    David

Posting Permissions

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