Run-time error '1004' Range.boarders

Viewed 854

Receiving an error with this segment of code. I am using code from Excel 2010 worksheet, where it works without issue, on an Excel 2013 computer. All of my libraries have updated correctly and we are not sure why this does not seem to be forward compatible.

With Me.Range("T3:Y196")

    .borders(xlEdgeBottom).Weight = xlThick
    .borders(xlEdgeLeft).Weight = xlThick
    .borders(xlEdgeRight).Weight = xlThick    '<--- error here
    .borders(xlEdgeTop).Weight = xlThick      '<--- once above code is commented out error occurs here

End With

Also receiving an error here:

With Range(ConvertColumnNumberToLetter(questionTextCol - 1) & CStr(myRow) & ":" & ConvertColumnNumberToLetter(instructionsCol) & CStr(myRow)).borders(xlEdgeTop)
'above Range gives same result as "T3:Y196" but I hard coded it to do some testing in the previous With Statement
    .LineStyle = xlContinuous    '<--- Error
    .ColorIndex = 0
    .TintAndShade = 0
    .Weight = xlMedium           '<--- Error
End With

Now, both .LineStyle and .Weight work in other areas of the code so we are not sure what to do about this.

When I record a macro I get this:

With Selection.Borders(xlEdgeBottom)
    .LineStyle = xlContinuous
    .ColorIndex = 0
    .TintAndShade = 0
    .Weight = xlMedium
End With

When I add the range in it works to perfection (again this is on a clean sheet):

With Range("C2:I20")
    .Borders(xlEdgeBottom).Weight = xlMedium
    .Borders(xlEdgeRight).Weight = xlMedium
    .Borders(xlEdgeLeft).Weight = xlMedium
    .Borders(xlEdgeTop).Weight = xlThick
End With

Any assistance would be greatly appreciated. Thanks!

1 Answers
Related