|
- Sub test()
- Dim rg, rng As Range, i&
- With Sheets(1)
- iRow = .Cells(Rows.Count, 1).End(3).Row '获得工作表有效数据区域的行数
- iCol = .Cells(3, Columns.Count).End(xlToLeft).Column '获得工作表有效数据区域的列数
- Set rng = .Range(.Cells(1, 1), .Cells(iRow, iCol)) '定义rng为有效数据范围
- For Each rg In rng '遍历rng区域,去公式,只保留值
- rg.Value = rg.Value
- Next
-
- For i = iCol To 1 Step -1 '倒序遍历第3行的单元格,删除下边线为xlDashDotDot线型的列
- With .Cells(3, i).Borders(xlEdgeBottom)
- If .LineStyle = xlDashDotDot Then '实线xlContinuous,点画相间线 xlDashDotDot
- Sheets(1).Cells(3, i).EntireColumn.Delete
- End If
- End With
- Next i
-
- If Len(.[a1]) = 0 Then .[a1] = "报表"
- End With
- End Sub
- 试下是否合乎你的需求。
复制代码 |
|