A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
If you are familiar with VB, this little sub is all what you need. Execute it in your sheet and watch out the output.
Sub Test()
Dim R As Range
Set R = ActiveWindow.VisibleRange
MsgBox _
"VisibleRange " & R.Address(0, 0) & vbCrLf & _
"UsedRange " & ActiveSheet.UsedRange.Address(0, 0)
End Sub
You have to compare the size of this two ranges, and adjust the width of each column. Record a macro to get some code how to shrink or expand a column.
But why want you do that? Why not zoom to show all data?
Sub MakeAllDataVisible()
If ActiveSheet.UsedRange.Columns.Count > ActiveWindow.VisibleRange.Columns.Count Then
Intersect(ActiveSheet.UsedRange.EntireColumn, _
ActiveWindow.VisibleRange.EntireRow).Select
ActiveWindow.Zoom = True
ActiveCell.Select
End If
End Sub
Much more easier.
Andreas.