I found the following code in one of the posts on this forum:
When i run it in Excel it works just fine but when i run it from solidworks then it says that xlCellTypeConstants variable not defined. Is xlCellTypeConstants something you can add in, in the references ?Sub Button1_Click()
Dim Rng As Range
Dim Arr As Variant
Dim i As Long
Arr = Array(xlCellTypeConstants)
For i = 0 To UBound(Arr)
Set Rng = Range(Cells(3, 2), Cells(Rows.Count, 2).End(xlUp)).SpecialCells(Arr(i), 23)
On Error GoTo 0
With Rng
.Borders(xlInsideHorizontal).Weight = xlThin
.Borders(xlInsideVertical).Weight = xlThin
.BorderAround ColorIndex:=xlAutomatic, Weight:=xlThin
End With
'clear the variable
Set Rng = Nothing
Next i
End Sub
Thanks for any help.
Bookmarks