写在前面 自动调整行高列宽 Sub 自动调整列宽() Cells.Select Cells.EntireColumn.AutoFit End Sub
Sub 自动标准行高() Cells.Select Cells.EntireRow.AutoFit End Sub 取消合并单元格 相当于“主页”选项卡上的取消合并选项,以下代码将取消所选内容中的所有合并单元格,如果需要取消特定范围,可以将selection改成具体范围。
突出显示内容错误单元格 Sub 定位错误单元格() Dim rng As Range For Each rng In ActiveSheet.UsedRange If Not Application.CheckSpelling(word:=rng.Text) Then rng.Style = 'Bad' End If Next rng End Sub 调整图表大小
删除空工作表 Sub 删除空白工作表() Dim Ws As Worksheet On Error Resume Next Application.ScreenUpdating= False Application.DisplayAlerts= False For Each Ws In Application.Worksheets If Application.WorksheetFunction.CountA(Ws.UsedRange) = 0 Then Ws.Delete End If Next Application.ScreenUpdating= True Application.DisplayAlerts= True End Sub THE END 创作不易, 您的支持是我坚持的动力, 劳烦动动手指转发、在看 |
|
来自: asaser > 《公众号左手excel右手VBA》