try
...{
// Turn off screen updating.
Application.ScreenUpdating = false;
Excel.Range rng = Application.get_Range("A1",missing);
for (int i = 0; i <= 20; i++)
...{
rng.get_Offset(i, 0).Value2 = i;
// Without the leading "''", these references
// get evaluated, rather than displayed directly.
rng.get_Offset(i, 1).Value2 = i*10;
rng.get_Offset(i, 2).Value2 = i*100;
rng.get_Offset(i, 3).Value2 = i*1000;
}
rng.CurrentRegion.Columns.AutoFit();
}
catch (Exception ex)