|
本帖最后由 cmo9020 于 2024-8-4 09:25 编辑
请问各位导师们
小弟有一个代码需要修改
1.解除筛选
2.删除j列图片
3.将第3行以下一直到A列没有数值的区域,高度修改成16.5
现在遇到一个困难,在excel 2010执行代码时遇到2万多笔数据时候
将A列第3行以下一直到无数值的区,行高修改成16.5时执行速度会很慢,
要怎么写才能让处理行高这部份执行速度在快一些
请导师们写一个单独处理行高部份的代码参考一下,谢谢
Test.rar
(952.46 KB, 下载次数: 12)
Sub ModifyWorksheet()
Dim ws As Worksheet
Dim lastRow As Long
Application.ScreenUpdating = False
Application.EnableEvents = False
Set ws = ThisWorkbook.Sheets("Sheet1")
On Error Resume Next
ws.ShowAllData
On Error GoTo 0
Dim Sh As shape
For Each Sh In ws.Shapes
If Sh.Type = msoPicture Then
If Not Intersect(Sh.TopLeftCell, ws.Columns("J")) Is Nothing Or _
Not Intersect(Sh.BottomRightCell, ws.Columns("J")) Is Nothing Then
Sh.Delete
End If
End If
Next Sh
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
If lastRow > 3 Then
ws.Rows("3:" & lastRow).RowHeight = 16.5
End If
End Sub
|
|