Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JCO JCO is offline
external usenet poster
 
Posts: 54
Default GridLines Inadvertantly Goes Away with Macro

I have a Macro that does several things including getting the Cell
Background Fill, store it, do some work, then restore the Cell Background
Fill. However, when doing this, the Cell Gridlines are gone. I understand
I can set the Background Fill to "No Color" to restore this, but that would
defeat the purpose of restoring the color as mentioned earlier.

Code snip below:
' Change Cell Background Color
'
Dim vCellBackgroundFill As Variant 'store color
Dim vCellBackgroundNoFill As Variant 'store background grid

vCellBackgroundFill = Selection.Interior.Color

' Do other work here

With Selection.Interior
.Color = vCellBackgroundFill 'restore background fill to
original color
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.TintAndShade = 0
.PatternTintAndShade = 0
End With

Thanks for your help





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default GridLines Inadvertantly Goes Away with Macro

JCO expressed precisely :
I have a Macro that does several things including getting the Cell
Background Fill, store it, do some work, then restore the Cell
Background Fill. However, when doing this, the Cell Gridlines are
gone. I understand I can set the Background Fill to "No Color" to
restore this, but that would defeat the purpose of restoring the
color as mentioned earlier.

Code snip below:
' Change Cell Background Color
'
Dim vCellBackgroundFill As Variant 'store color
Dim vCellBackgroundNoFill As Variant 'store background grid

vCellBackgroundFill = Selection.Interior.Color

' Do other work here

With Selection.Interior
.Color = vCellBackgroundFill 'restore background
fill to original color
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.TintAndShade = 0
.PatternTintAndShade = 0
End With

Thanks for your help


Gridlines only display when cells have no .Interior.Color! You can,
however, simulate gridlines by giving cells with color a dotted line
border.<g

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #3   Report Post  
Posted to microsoft.public.excel.programming
JCO JCO is offline
external usenet poster
 
Posts: 54
Default Gridlines Inadvertently Goes Away with Macro

Okay but that would print when you turn grids off for printing?

After rethinking this, I may not need to do that at all. When a cell is
filled, I'm thinking the lines are suppose to match that color. Something I
was not doing before. You can't see or tell the colors of the Cell lines,
therefore, I'm thinking it's not an issue.

Unless anyone else knows better?
thanks


"GS" wrote in message ...

JCO expressed precisely :
I have a Macro that does several things including getting the Cell
Background Fill, store it, do some work, then restore the Cell Background
Fill. However, when doing this, the Cell Gridlines are gone. I
understand I can set the Background Fill to "No Color" to restore this,
but that would defeat the purpose of restoring the color as mentioned
earlier.

Code snip below:
' Change Cell Background Color
'
Dim vCellBackgroundFill As Variant 'store color
Dim vCellBackgroundNoFill As Variant 'store background grid

vCellBackgroundFill = Selection.Interior.Color

' Do other work here

With Selection.Interior
.Color = vCellBackgroundFill 'restore background fill
to original color
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.TintAndShade = 0
.PatternTintAndShade = 0
End With

Thanks for your help


Gridlines only display when cells have no .Interior.Color! You can,
however, simulate gridlines by giving cells with color a dotted line
border.<g

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Gridlines Inadvertently Goes Away with Macro

After serious thinking JCO wrote :
Okay but that would print when you turn grids off for printing?


If you use Conditional Formatting to apply the dotted borders then you
can also switch these off for printing. All you need is a cell to
contain the switch 'flag' so you can toggle it how you want to
view/print your data.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


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
Gridlines are there, then Custom View, gridlines disappear in xl 2 Winnipeg Michael Excel Discussion (Misc queries) 0 September 15th 08 06:04 PM
not all the gridlines print; despite selecting/"gridlines" suewholovesbirds Excel Discussion (Misc queries) 1 October 23rd 06 09:33 PM
Row colors overlay the gridlines...how do I show gridlines? RickToo11 Excel Discussion (Misc queries) 2 September 13th 06 03:46 PM
In Excel, gridlines won't print--File,PageSetup,Sheet,Gridlines-- 4most New Users to Excel 3 July 9th 06 01:45 AM
Where are my gridlines? Badger Excel Worksheet Functions 2 January 5th 06 05:42 PM


All times are GMT +1. The time now is 09:01 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"