Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Automatically fitting cell sizes to contents


I'm currently working with a lot of comma separated value (.CSV) files.
Whenever these files are opened in Excel (2000), since all size
information is not present, each cell is given the same tiny size.

What I need is either
1. An option that says "automatically fit cell sizes to contents upon
file opening", or

2. A method of fitting cell sizes to contents that is quicker and less
tedious than double-clicking at the top of each column (since there are
40 or so columns in each spreadsheet).

Before you ask, no I can't just save the files in .XLS format, they
need to stay as .CSV files for compatibility with other software.

Do either of my options exist?

Thanks in advance for your response,
Richie.


--
cornelius1729
------------------------------------------------------------------------
cornelius1729's Profile: http://www.excelforum.com/member.php...o&userid=36749
View this thread: http://www.excelforum.com/showthread...hreadid=564690

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Automatically fitting cell sizes to contents


Hi

To autofit any column I usually but this code in:
Open your excel spreadsheet. Go to Tools Macros Visual Basic Editor
(or you can just press Alt + F11)

On the left side is the Project Explorer. You should see something with
the name VBAProject (Name of your excel file)

Click it if it is not expanded already, and double click on Sheet1 (or
the name of your worksheet). Put the code in the box that pops up.


Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
ActiveSheet.UsedRange.Select
Selection.Columns.AutoFit
Application.EnableEvents = False
Range("a1").Select
Application.EnableEvents = True
End Sub


--
jetted
------------------------------------------------------------------------
jetted's Profile: http://www.excelforum.com/member.php...o&userid=17532
View this thread: http://www.excelforum.com/showthread...hreadid=564690

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Automatically fitting cell sizes to contents


Thanks jetted,

The code works great, though it needed to be a personal macro, rather
than one for that worksheet, so I can use it on all the spreadsheets.

Richie.


--
cornelius1729
------------------------------------------------------------------------
cornelius1729's Profile: http://www.excelforum.com/member.php...o&userid=36749
View this thread: http://www.excelforum.com/showthread...hreadid=564690

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Automatically fitting cell sizes to contents

I wouldn't bother with a macro.

I'd import the data
Select all the cells
(click on that grey box to the left of the column headers and above the row
headers)
and then adjust all the columns at once by double clicking on any of those
column separator lines.

Ctrl-A (a few times, depending on your version of excel) is another way to
select all the cells.





cornelius1729 wrote:

I'm currently working with a lot of comma separated value (.CSV) files.
Whenever these files are opened in Excel (2000), since all size
information is not present, each cell is given the same tiny size.

What I need is either
1. An option that says "automatically fit cell sizes to contents upon
file opening", or

2. A method of fitting cell sizes to contents that is quicker and less
tedious than double-clicking at the top of each column (since there are
40 or so columns in each spreadsheet).

Before you ask, no I can't just save the files in .XLS format, they
need to stay as .CSV files for compatibility with other software.

Do either of my options exist?

Thanks in advance for your response,
Richie.

--
cornelius1729
------------------------------------------------------------------------
cornelius1729's Profile: http://www.excelforum.com/member.php...o&userid=36749
View this thread: http://www.excelforum.com/showthread...hreadid=564690


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom functions calculating time arguments Help Desperate Bill_De Excel Worksheet Functions 12 April 25th 06 02:22 AM
Getting contents of a cell when cell reference is in the sheet A Nelson Excel Discussion (Misc queries) 3 October 5th 05 06:46 PM
How do I clear the contents of one cell from another cell? RonB Excel Worksheet Functions 1 September 26th 05 07:33 PM
How do I get Excel to automatically enter the contents of a cell . andyb66 Excel Discussion (Misc queries) 1 January 22nd 05 08:04 AM
How do I automatically rename a sheet with the contents of a cell. michaelspearin Excel Discussion (Misc queries) 3 December 3rd 04 09:27 PM


All times are GMT +1. The time now is 01:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"