PDA

View Full Version : Solved: Increasing column width



Ashes.cfg
10-24-2007, 08:26 AM
Hi guys
I tried lots but the same problem is persisting..check this excel file out..check sheet1 and column A
if u manually increase the width u can see that there is a valid date in it..but it shows ###### always when i open it.. I am actually scripting in perl..but if i get a vba code for it it wud b good as thn i can try to change it into perl..dnt record a macro as i have tried it.

thanks!!

JKwan
10-24-2007, 08:44 AM
Well, for whatever the reason, Workbook_Open does not execute. But if you add a Module to it and then add this code, it will auto size it for you.
Sub auto_open()
Worksheets("Sheet1").Columns("A:A").EntireColumn.AutoFit
End Sub

lucas
10-24-2007, 08:52 AM
What same problem are you refering to ashes....????
If you want it to autofit when you open the workbook put this in the thisworkbook module....it works for me.....
Private Sub Workbook_Open()
Worksheets("Sheet1").Columns("A:A").EntireColumn.AutoFit
End Sub

If you just want to run it from time to time manually then put this in a standard module:

Sub FixColumn()
Worksheets("Sheet1").Columns("A:A").EntireColumn.AutoFit
End Sub

lucas
10-24-2007, 08:55 AM
If you have another thread where you have asked this question you should post your followup questions in that thread....otherwise it gets confusing for those trying to help you......if there is such a thread please post a link to it.

lucas
10-24-2007, 08:58 AM
see attached

Ashes.cfg
10-24-2007, 10:27 AM
Ok it worked now...sadly wasnt working b4..thanks!! topic solved..breathing a sigh of relief now!!! husshh!!