I have often to open CSV files in Excel (14.0.6112.5000; Office 2010). The data is filled well in the columns, but the DateTime values exceed the default column with and are display as ######. So I have to manually change this width. Further I would like to have to freeze the window at row/colum C2.

Is there a way to do this when opening a CSV automatically or have a script that can be activated by a button?


You could do this by recording a macro. So choose the Developer tab, and Record Macro.

Then do the sequence Ctrl-AAlt-Hoi

This selects all, goes to the Home tab, format, and autofit columns

And stop recording the macro. You can then save the macro, and give it a shortcut key to activate it when you want.

You could also carry out the freeze panes for the top row this way also.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.