ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Runtime error on a PC: Selection.Borders(xlEdgeLeft).TintAndShade =-0.14996795556505 (https://www.excelbanter.com/excel-programming/425183-runtime-error-pc-selection-borders-xledgeleft-tintandshade-%3D-0-14996795556505-a.html)

Alan[_8_]

Runtime error on a PC: Selection.Borders(xlEdgeLeft).TintAndShade =-0.14996795556505
 
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
. . .




JLGWhiz

Runtime error on a PC: Selection.Borders(xlEdgeLeft).TintAndShade
 
TintAndShade is not a property of the Borders collection object in xl2003.
He has the option of Color or ColorIndex.

"Alan" wrote:

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
. . .





Alan[_8_]

Runtime error on a PC: Selection.Borders(xlEdgeLeft).TintAndShade
 
Thanks! Alan


All times are GMT +1. The time now is 04:27 PM.

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