Macro (SVB) Programs Example - Auto-Fitting a Spreadsheet's Variable Columns

This example will iterate through all of the open, individual spreadsheets and auto-fit each variable column to the proper width.

Sub Main()
'This macro will auto fit variable columns of every open, individual spreadsheet
Dim i As New Spreadsheet 'loop through every individual spreadsheet window
For Each i In Application.Spreadsheets 'loop through each variable column
'one spreadsheet at a time
For j = 1 To i.Variables.Count 'autofit each variable column, one at a time
i.Variable(j).AutoFit
Next j
Next i
End Sub