Columns - autofit

L

learning_codes

Hi there….

I have 14 columns on the excel spreadsheet. The first column should
set the size “10” and other 13 columns to set fit automatically.

When I use the code like this >>> ExcelWorksheet.Columns.AutoFit
<<<<

I want to set the size of the width = 10 on the first column and the
rest of the column set automatically.

Your help would be much appreciated.

Thanks
 
D

Dave Peterson

With ExcelWorksheet
.range("b1").resize(1,13).entirecolumn.autofit
.range("A1").entirecolumn.columnwidth = 10
end with
 
L

learning_codes

With ExcelWorksheet
   .range("b1").resize(1,13).entirecolumn.autofit
   .range("A1").entirecolumn.columnwidth = 10
end with












--

Dave Peterson- Hide quoted text -

- Show quoted text -

Hi Dave,

Thank you very much ... It works like a charm.

Only problem I have is that 14 columns do not fit one page but have
200 pages.

example: 13 columns on one page of 200. It should be 14 columns
on one page of 145 pages.

Is there a way to do this ? Your help would be much apprecated. ;-)

Thanks
 
D

Dave Peterson

Are you writing about worksheets (I'm not sure what pages means here).

And if you do mean worksheets, how do you know which ones are 13 columns and
which are 14? By name or by location or some other indicator????
 
L

learning_codes

Are you writing about worksheets (I'm not sure what pages means here).

And if you do mean worksheets, how do you know which ones are 13 columns and
which are 14?  By name or by location or some other indicator????













--

Dave Peterson- Hide quoted text -

- Show quoted text -

Sorry for not explaining clearly. I have 14 column headings and
trying to make a fit on one page. I set '10' for the first column
width and then the rest of the column to make autofit. I have couple
of worksheets that has some different widths of each columns. It
works great but when I click Preview there are 200 pages, last few
pages show one column headings and first few pages show 13 column
headings.

Thanks
 
D

Dave Peterson

It sounds like you want to make sure that the print is 1 page wide by ?? pages
long.

In xl2003 menus:
File|Page setup|Page tab
Check the "Fit to" optionbutton.
Use 1 page wide and leave the how many pages tall box empty.

Or maybe...

If that last column is really empty, make sure that the print range is
correct--that it doesn't include that last column.

Select the area to print (all of columns 1-13???)
File|print area|set print area
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top