View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.newusers
Sandy Mann Sandy Mann is offline
external usenet poster
 
Posts: 2,345
Default wasy macro question

This is what I get in XL97 when I use the Macro Recorder:

Cells.Select
Selection.Columns.AutoFit

You can of course take out the two Selects and just have:

Cells.Columns.AutoFit

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"gls858" wrote in message
...
I used the macro recorder to get the code to resize columns on a worksheet

Cells.Select
Range("A1766").Activate
Cells.EntireColumn.AutoFit

What I don't understand in the Range. It's seems to be referring to a
single cell. Could someone explain to a VBA newbie?

I'm importing a text file and I want to resize the columns after import.
I have the import working just need this one last thing.

The worksheet will always have the same number of columns but the number
of rows may vary will the above code still work?

gls858