Option Explicit
Public Sub Dem_Border()
Application.ScreenUpdating = False
Dim rngData As Range
Dim dem, cell_F
Set rngData = Selection
For Each cell_F In rngData
cell_F.Select
With Selection.Borders(xlEdgeLeft)
If .LineStyle <> xlNone Then
dem = dem + 1
.LineStyle = xlNone
End If
End With
With Selection.Borders(xlEdgeTop)
If .LineStyle <> xlNone Then
dem = dem + 1
.LineStyle = xlNone
End If
End With
With Selection.Borders(xlEdgeBottom)
If .LineStyle <> xlNone Then
dem = dem + 1
.LineStyle = xlNone
End If
End With
With Selection.Borders(xlEdgeRight)
If .LineStyle <> xlNone Then
dem = dem + 1
.LineStyle = xlNone
End If
End With
Next cell_F
rngData.Select
Application.ScreenUpdating = True
MsgBox dem
End Sub