vba gridlinecolorindex question

C

chick-racer

i am having difficulty getting this to work.
basically, this part of the program is to reset the colored fonts an
interior color of the cells etc from the last run of the macro.

I'm getting an error, AND also, when this is executed, the "fake
default gridlines disappear altogether. Can someone steer me in th
right direction?

thank you.

ActiveSheet.Cells.Font.ColorIndex = xlColorIndexAutomatic
ActiveSheet.Cells.Interior.ColorIndex = xlColorIndexAutomatic

ActiveSheet.GridlineColorIndex = xlColorIndexAutomatic
'the last one is the troublesome lin
 
C

chick-racer

actually on further testing, the second line is the problem.
This was only supposed to change the cells with colored background bac
to origional default.. Instead it eliminates the grey default gridline
that excel has (which dont print)
I would like to have those visible, is there a way to erase th
interior color of the cells and not eliminate the grey gridlines
 
T

Tom Ogilvy

ActiveSheet.Cells.Font.ColorIndex = xlColorIndexAutomatic
ActiveSheet.Cells.Interior.ColorIndex = xlColorIndexNone

Not sure what you are trying to do with the last command, but if you have
used borders, then you need to work with the borders object.

Turn on the macro recorder and make the changes you want to get the code.
 
T

Tom Ogilvy

Sure, use the correct constant which is xlNone or xlColorIndexNone

This is spelled out pretty clearly in the help for the colorindex property:

For interior:
Set this property to xlColorIndexNone to specify that you don't want an
interior fill.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top