View Single Post
  #3   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 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