自动调整表格以适应屏幕

我有一个查询数据库的Excel表 – 它返回的行数波动。

有没有人知道如何自动调整行的大小,当行数量变化,使整个表总是适合在屏幕上?

这听起来好像你指的是缩放。 所有的信用到Chip Pearson这个方便的子。

用法示例: call ZoomToRange(activesheet.cells(1,1).currentregion, true)

 Sub ZoomToRange(ByVal ZoomThisRange As Range, _ ByVal PreserveRows As Boolean) 'http://www.cpearson.com/excel/zoom.htm Dim Wind As Window Set Wind = ActiveWindow ' ' Put the upper left cell of the range in the top-left of the screen. ' Application.Goto ZoomThisRange(1, 1), True With ZoomThisRange If PreserveRows = True Then .Resize(.Rows.Count, 1).Select Else .Resize(1, .Columns.Count).Select End If End With With Wind .Zoom = True .VisibleRange(1, 1).Select End With End Sub