ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vba gridlinecolorindex question (https://www.excelbanter.com/excel-programming/283442-vba-gridlinecolorindex-question.html)

chick-racer[_40_]

vba gridlinecolorindex question
 

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

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com


chick-racer[_41_]

vba gridlinecolorindex question
 

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

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com


Tom Ogilvy

vba gridlinecolorindex question
 
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.

--
Regards,
Tom Ogilvy


"chick-racer" wrote in message
...

i am having difficulty getting this to work.
basically, this part of the program is to reset the colored fonts and
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 the
right direction?

thank you.

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

ActiveSheet.GridlineColorIndex = xlColorIndexAutomatic
'the last one is the troublesome line


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/




Tom Ogilvy

vba gridlinecolorindex question
 
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.

--
Regards,
Tom Ogilvy


"chick-racer" wrote in message
...

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


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 05:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com