g3jimha
08-10-2011, 05:31 AM
hi there, im currently trying to make a macro to start automatically when the a file is opened, its just really to change the default column width in excel. but when i try and run it i just get errors all the time. I'm using excel 2007. My code is
Sub Auto_Open()
'
' Auto_Open Macro
'
Columns("A:Z").select
Range("Z1").Activate
selection.coulmnwidth=20
with selection
.horizontalAlignment=x1Left
.VerticalAlignment= x1Bottom
.Orientation=0
.WrapText=False
.IndentLevel=0
.ShrinkToFit=False
.ReadingOrder=xlContext
.MergeCells=False
end with
activeWindow.LargeScroll ToRight:=-1
Range("K1").select
activeWindow.smallScroll Down:=-15
End Sub
And the Error is "Method 'Columns' of object '_Global' failed"
if anyone could help thatd be great thanks :), Jim
Sub Auto_Open()
'
' Auto_Open Macro
'
Columns("A:Z").select
Range("Z1").Activate
selection.coulmnwidth=20
with selection
.horizontalAlignment=x1Left
.VerticalAlignment= x1Bottom
.Orientation=0
.WrapText=False
.IndentLevel=0
.ShrinkToFit=False
.ReadingOrder=xlContext
.MergeCells=False
end with
activeWindow.LargeScroll ToRight:=-1
Range("K1").select
activeWindow.smallScroll Down:=-15
End Sub
And the Error is "Method 'Columns' of object '_Global' failed"
if anyone could help thatd be great thanks :), Jim