ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   adding code to shrink columns to reasonable width (https://www.excelbanter.com/excel-programming/335459-adding-code-shrink-columns-reasonable-width.html)

Todd F.[_2_]

adding code to shrink columns to reasonable width
 
I would like to add somehting to this clean up macro:

Sub Cleanup()
With ActiveWorkbook
.Names("Database").Delete
Application.DisplayAlerts = False
.SaveAs .FullName, xlWorkbookNormal
Application.DisplayAlerts = True
End With
End Sub

the above macro clears out a named range and it does a save as to the
current version of excel.

is it possible to added to the tail end of this routine the task of
shrinking the column width down to the widest value in the column - for some
reason the columns come though overly large "wide"


Tom Ogilvy

adding code to shrink columns to reasonable width
 
Sub Cleanup()
With ActiveWorkbook
.Names("Database").Delete
Application.DisplayAlerts = False
.SaveAs .FullName, xlWorkbookNormal
Application.DisplayAlerts = True
Activesheet.columns.Autofit
End With
End Sub

--
Regards,
Tom Ogilvy


"Todd F." wrote in message
...
I would like to add somehting to this clean up macro:

Sub Cleanup()
With ActiveWorkbook
.Names("Database").Delete
Application.DisplayAlerts = False
.SaveAs .FullName, xlWorkbookNormal
Application.DisplayAlerts = True
End With
End Sub

the above macro clears out a named range and it does a save as to the
current version of excel.

is it possible to added to the tail end of this routine the task of
shrinking the column width down to the widest value in the column - for

some
reason the columns come though overly large "wide"




Todd F.[_2_]

adding code to shrink columns to reasonable width
 
Hey Tom I did not want to continue to bother you - I do apprecaite your
additional time.

I got involved with somehting that it looks like I will fianlly be able to
get into some good VBA work.

Todd

"Tom Ogilvy" wrote:

Sub Cleanup()
With ActiveWorkbook
.Names("Database").Delete
Application.DisplayAlerts = False
.SaveAs .FullName, xlWorkbookNormal
Application.DisplayAlerts = True
Activesheet.columns.Autofit
End With
End Sub

--
Regards,
Tom Ogilvy


"Todd F." wrote in message
...
I would like to add somehting to this clean up macro:

Sub Cleanup()
With ActiveWorkbook
.Names("Database").Delete
Application.DisplayAlerts = False
.SaveAs .FullName, xlWorkbookNormal
Application.DisplayAlerts = True
End With
End Sub

the above macro clears out a named range and it does a save as to the
current version of excel.

is it possible to added to the tail end of this routine the task of
shrinking the column width down to the widest value in the column - for

some
reason the columns come though overly large "wide"






All times are GMT +1. The time now is 01:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com