1. 设置单元格边框:

.Range("A3:M" & l + 1).Select
With Selection.Borders()
  .LineStyle = xlContinuous
  .ColorIndex = 0
  .TintAndShade = 0
  .Weight = xlHairline'实线
End With

.Range("I3:M" & l + 1).Borders(xlEdgeLeft).Weight = xlThin'细实线
.Range("I3:M" & l + 1).Borders(xlEdgeTop).Weight = xlThin
.Range("I3:M" & l + 1).Borders(xlEdgeBottom).Weight = xlThin
.Range("I3:M" & l + 1).Borders(xlEdgeRight).Weight = xlThin

'若 产品不同,则“粗线”
For i = 5 To l
  If .Cells(i, 6).Value <> .Cells(i - 1, 6).Value Then
    .Range("A" & i & ":P" & i).Borders(xlEdgeTop).Weight = xlThin
  End If
Next i


04-28 01:55