|
Range(Cells(2, 6), Cells([h10000].End(3).Row, 8)).Delete Shift:=xlUp '删除原有表格
hs = 2 '从第2行开始显示,第1行是标题
For i = 2 To [a10000].End(3).Row
s1 = Split(Cells(i, 2), "、")
s2 = Split(Cells(i, 3), "、")
js = hs
For k = 0 To UBound(s1)
If k = 0 Then
Cells(hs, 6) = Cells(i, 1)
End If
Cells(hs, 7) = s1(k)
Cells(hs, 8) = s2(k)
hs = hs + 1
Next k
If UBound(s1) > 0 Then
Range(Cells(js, 6), Cells(hs - 1, 6)).Merge '大于1个单位就合并单元格
End If
Next i
Range(Cells(2, 6), Cells([h10000].End(3).Row, 8)).Select '下面是划表格线,在录制宏基础上简化而来
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlContinuous
Selection.Borders(xlEdgeTop).LineStyle = xlContinuous
Selection.Borders(xlEdgeBottom).LineStyle = xlContinuous
Selection.Borders(xlEdgeRight).LineStyle = xlContinuous
Selection.Borders(xlInsideVertical).LineStyle = xlContinuous
Selection.Borders(xlInsideHorizontal).LineStyle = xlContinuous
Range("f1").Select
|
|