Runtime error on a PC: Selection.Borders(xlEdgeLeft).TintAndShade =-0.14996795556505

A

Alan

I have some code that formats a spreadsheet. A user running Excel
2003 gets a runtime error on the ".TintAndShade" statement below. I
do not get an error. Could this be related to some Reference I need
to set programmatically?

I took this code fragment from a recorded macro.

With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.TintAndShade = -0.14996795556505
.Weight = xlThin

The complete subroutine is shown below.

Thanks, Alan

Sub GreyGridlines()
'
' This subroutine adds light grey gridlines to selected
' columns of the output spreadsheet
'
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.TintAndShade = -0.14996795556505
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.TintAndShade = -0.14996795556505
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.TintAndShade = -0.14996795556505
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.TintAndShade = -0.14996795556505
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.TintAndShade = -0.14996795556505
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.TintAndShade = -0.14996795556505
.Weight = xlThin
End With
End Sub

The way this is called is by this subroutine:

Sub SetCellFormats(CmdWB As Workbook, DataWB As Workbook)
'
' This subroutine modifies the format of the cells in Rows
' A through P of the output spreadsheet
''
Dim i As Integer, DataRowCount As Integer
Dim switch As Boolean, MyFont As Font
' Select the columns to modify
Columns("A:p").Select
' Add light grey gridlines
GreyGridlines
. . .
 
J

JLGWhiz

TintAndShade is not a property of the Borders collection object in xl2003.
He has the option of Color or ColorIndex.
 

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