View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Tony Girgenti Tony Girgenti is offline
external usenet poster
 
Posts: 21
Default How to change column size in VB6 and Excel 2002

Hello JLGWhiz.

I used the code posted by kounoike in this thread. It works fine except
that it doesn't change the column width. I makes all of the other changes as
far as values and fonts, etc., but not the column width.

Can this really be done?

Thanks,
Tony

"JLGWhiz" wrote:

What exactly do you have the variable osheet equal to?
Better yet, is it a variable or a sheet name?

"Tony Girgenti" wrote:

Hello GTVT06.

I'm getting Subscript out of range when i try your code.

Thanks,
Tony

"GTVT06" wrote:

On Jan 15, 8:21 pm, Tony Girgenti wrote:
Hello.

Using VB6.0 and Excel 2002. I'm trying to change the column width of a
column before saving the workbook. I can do other changes to the worksheet,
like fonts and values etc., but it won't change the columnwidth.

I tried these statements and none of them work:
oSheet.Range("A1").Columns.ColumnWidth = 5.75
oSheet.Range("A1").ColumnWidth = 5.75
oSheet.Columns("A:A").ColumnWidth = 5.75

oSheet.Columns("A").Select
Selection.ColumnWidth = 5.75

Does anybody know how to do this?

Any help would be gratefully appreciated.

Thanks,
Tony

Try:

Sheets("oSheet").Columns("A:A").ColumnWidth = 5.75