用宏吧。同时按Alt和F11进入宏界面,点菜单的插入,模块,粘贴如下代码:
Sub test()
Application.ScreenUpdating = False
Dim i As Integer
Dim xRng As Range
Set xRng = ActiveSheet.UsedRange
For i = 1 To xRng.Columns.Count
If WorksheetFunction.CountA(xRng.Columns(i)) = 0 Then xRng.Columns(i).Hidden = True
Next i
Application.ScreenUpdating = True
End Sub
在此界面直接按F5运行此宏,完成。