
Signature
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)
This (code) seems to be removing the grid/border lines. Can this be also
handled to maintain the original look, including the borders/grid lines
arounf the cell?
> Right click the appropriate sheet tab, choose View Code, and paste in the
> following:
[quoted text clipped - 19 lines]
> >
> > Thanks
Dave Peterson - 23 Sep 2007 02:14 GMT
I don't think it's touching the borders (format|Cell|border).
But if you add fill colors to cells, then the gridlines
(tools|Options|view tab|gridlines)
will seem to disappear.
But that happens no matter how you apply that fill color.
Another good reason to not show the gridlines and use borders instead <bg>.
> This (code) seems to be removing the grid/border lines. Can this be also
> handled to maintain the original look, including the borders/grid lines
[quoted text clipped - 31 lines]
> > >
> > > Thanks

Signature
Dave Peterson
Peter T - 23 Sep 2007 09:50 GMT
Can simulate the gridlines that become hidden with the fill colour by adding
similar looking grey borders
With Target.Borders
.LineStyle = xlContinuous
.Weight = xlThin
.Color = RGB(192, 192, 192)
'or if sure using a default palette
'.ColorIndex = 15
End With
remove with
Target.Borders.Colorindex = xlNone
Before applying the above might want to check user has not already applied
own border to one or more edges.
Regards,
Peter T
> This (code) seems to be removing the grid/border lines. Can this be also
> handled to maintain the original look, including the borders/grid lines
> arounf the cell?
The technique in my comment below can actually be applied to each of the
respondents so far; however, I have a question for you directly (which is in
the PS at the end of my message)...
> Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
> Boolean)
[quoted text clipped - 10 lines]
> Change the address from $A$1 to the appropriate cell and change the 6 to
> the desired ColorIndex value (see VBA Help for a list of colors).
Using your example color index of 6, your interior If-Then-Else block can be
replaced with this one-liner code...
Target.Interior.ColorIndex = (6 + xlColorIndexAutomatic) - _
Target.Interior.ColorIndex
I used a line continuation to prevent newsreaders from splitting the line in
an inappropriate location, but it is a one-liner.
Rick
PS - Did you receive any email messages from me last month or at the
beginning of this month? If you don't want to respond to the question I
asked in them, that is fine, no problem; but I was wondering if you even got
emails in the first place.
Peter T - 23 Sep 2007 10:07 GMT
> > Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
> > Boolean)
[quoted text clipped - 16 lines]
> Target.Interior.ColorIndex = (6 + xlColorIndexAutomatic) - _
> Target.Interior.ColorIndex
This might be OK if can be certain Target.Interior.ColorIndex is either 6 or
xlColorIndexAutomatic -4105. But if it's xlNone -4142 (default no fill) or
not 6 it may fail completely or apply 6+(-4105)-(-4142) ie 43.
Regards,
Peter T
Rick Rothstein (MVP - VB) - 23 Sep 2007 15:45 GMT
>> > Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
>> > As
[quoted text clipped - 22 lines]
> xlColorIndexAutomatic -4105. But if it's xlNone -4142 (default no fill) or
> not 6 it may fail completely or apply 6+(-4105)-(-4142) ie 43.
The OP's initial posting said that he wanted to toggle back and forth
between a color of his/her choice and the default color. The way the message
was worded seemed to indicate the cell were already one of these colors from
the start. But, with that said, you might be right (the starting color could
be starting off different from either of these), so your warning is
something I should have thought to include in my response... thanks for
doing so.
Rick
Little Penny - 23 Sep 2007 16:18 GMT
Rick I sorry but I did not read your email because its a email adress
I no longer use. For over a year now I have undated my email address.
I sorry
On Sun, 23 Sep 2007 00:14:01 -0400, "Rick Rothstein \(MVP - VB\)"
<rickNOSPAMnews@NOSPAMcomcast.net> wrote:
>The technique in my comment below can actually be applied to each of the
>respondents so far; however, I have a question for you directly (which is in
[quoted text clipped - 30 lines]
>asked in them, that is fine, no problem; but I was wondering if you even got
>emails in the first place.
Rick Rothstein (MVP - VB) - 23 Sep 2007 17:04 GMT
> Rick I sorry but I did not read your email because its a email adress
> I no longer use. For over a year now I have undated my email address.
I'm not sure why you posted this message... I did not attempt to send you an
email... my only responses dealing with your question were posted here, in
this thread.
Rick