Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Show Grid lines


The followin is what I am working on. What I don't like
is that it removes the grid lines. What do I change so that
when the cells are blank formated the gridlines still show?

Private Sub Worksheet_Calculate()

Application.ScreenUpdating = False

For y = 4 To 38
Cells(y, 10).Select
A_Done = Cells(y, 10)
If A_Done = "x" Then
' Range(ActiveCell, ActiveCell.End(xlToLeft)).Select
ActiveCell.Select
With Selection
.Interior.ColorIndex = 4
' .Interior.Pattern = xlSolid
.Font.ColorIndex = 4
End With
ElseIf A_Done = "o" Then
' Range(ActiveCell, ActiveCell.End(xlToLeft)).Select
ActiveCell.Select
With Selection
.Interior.ColorIndex = 2
' .Interior.Pattern = xlSolid
.Font.ColorIndex = 2
End With
End If
Next y

Application.ScreenUpdating = True

End Su

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Show Grid lines

Linc,

If you set the colour of a cell, it obliterates the gridlines unfortunately.

You could put a border around those cells.

Private Sub Worksheet_Calculate()

Application.ScreenUpdating = False

For y = 4 To 38
Cells(y, 10).Select
A_Done = Cells(y, 10)
If A_Done = "x" Then
' Range(ActiveCell, ActiveCell.End(xlToLeft)).Select
ActiveCell.Select
With Selection
Interior.ColorIndex = 4
' .Interior.Pattern = xlSolid
Font.ColorIndex = 4
End With
ElseIf A_Done = "o" Then
' Range(ActiveCell, ActiveCell.End(xlToLeft)).Select
ActiveCell.Select
With Selection
Interior.ColorIndex = 2
' .Interior.Pattern = xlSolid
Font.ColorIndex = 2
End With
AddBorders Selection
End If
Next y

Application.ScreenUpdating = True

End Sub

Sub AddBorders(rng As Range)
With rng
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With
End Sub



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Linc" wrote in message
...

The followin is what I am working on. What I don't like
is that it removes the grid lines. What do I change so that
when the cells are blank formated the gridlines still show?

Private Sub Worksheet_Calculate()

Application.ScreenUpdating = False

For y = 4 To 38
Cells(y, 10).Select
A_Done = Cells(y, 10)
If A_Done = "x" Then
' Range(ActiveCell, ActiveCell.End(xlToLeft)).Select
ActiveCell.Select
With Selection
Interior.ColorIndex = 4
' .Interior.Pattern = xlSolid
Font.ColorIndex = 4
End With
ElseIf A_Done = "o" Then
' Range(ActiveCell, ActiveCell.End(xlToLeft)).Select
ActiveCell.Select
With Selection
Interior.ColorIndex = 2
' .Interior.Pattern = xlSolid
Font.ColorIndex = 2
End With
End If
Next y

Application.ScreenUpdating = True

End Sub


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Show Grid lines

Linc

think you'll need to put a border round the cells

Regards

Trevor


"Linc" wrote in message
...

The followin is what I am working on. What I don't like
is that it removes the grid lines. What do I change so that
when the cells are blank formated the gridlines still show?

Private Sub Worksheet_Calculate()

Application.ScreenUpdating = False

For y = 4 To 38
Cells(y, 10).Select
A_Done = Cells(y, 10)
If A_Done = "x" Then
' Range(ActiveCell, ActiveCell.End(xlToLeft)).Select
ActiveCell.Select
With Selection
Interior.ColorIndex = 4
' .Interior.Pattern = xlSolid
Font.ColorIndex = 4
End With
ElseIf A_Done = "o" Then
' Range(ActiveCell, ActiveCell.End(xlToLeft)).Select
ActiveCell.Select
With Selection
Interior.ColorIndex = 2
' .Interior.Pattern = xlSolid
Font.ColorIndex = 2
End With
End If
Next y

Application.ScreenUpdating = True

End Sub


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



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
Excel grid lines show when pasting, didn't used to RindaRich Excel Discussion (Misc queries) 1 July 22nd 09 12:38 AM
Transferred file from QuatroPro. How do I get grid lines to show Sue Excel Discussion (Misc queries) 1 September 24th 08 05:22 PM
Cell grid lines won't show up, and have box checked Fran Jones Excel Discussion (Misc queries) 7 January 19th 08 01:14 AM
Show grid lines when printing? TKM New Users to Excel 4 October 21st 06 03:52 AM
Why do some grid lines not show in print preview? Swamp Excel Discussion (Misc queries) 5 September 5th 06 04:34 PM


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