Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code to change column widths?
I am running code to open a workbook and then I want to set all columns in
the workbook to 15. I use: ..Workbooks.Open "C:\Shared\Report Info.xlsx" ..Columns.ColumnWidth = 15 This code only works on the first sheet in the workbook, but I need it to work for all sheets. Can someone please help me? TIA |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code to change column widths?
Sub tryme()
Application.ScreenUpdating = False For Each wk In Worksheets Columns.ColumnWidth = 15 Next Application.ScreenUpdating = True End Sub best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "BABs" wrote in message ... I am running code to open a workbook and then I want to set all columns in the workbook to 15. I use: .Workbooks.Open "C:\Shared\Report Info.xlsx" .Columns.ColumnWidth = 15 This code only works on the first sheet in the workbook, but I need it to work for all sheets. Can someone please help me? TIA |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code to change column widths?
Columns.ColumnWidth = 15 should be Wk.Columns.ColumnWidth = 15 Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Wed, 18 Feb 2009 10:14:43 -0400, "Bernard Liengme" wrote: Sub tryme() Application.ScreenUpdating = False For Each wk In Worksheets Columns.ColumnWidth = 15 Next Application.ScreenUpdating = True End Sub best wishes |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code to change column widths?
Ooops, many thanks for corrections
-- Bernard "Chip Pearson" wrote in message ... Columns.ColumnWidth = 15 should be Wk.Columns.ColumnWidth = 15 Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Wed, 18 Feb 2009 10:14:43 -0400, "Bernard Liengme" wrote: Sub tryme() Application.ScreenUpdating = False For Each wk In Worksheets Columns.ColumnWidth = 15 Next Application.ScreenUpdating = True End Sub best wishes |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Column widths change with each new import from Access 2007 | New Users to Excel | |||
Automatically change column widths? | Excel Discussion (Misc queries) | |||
Why do column widths change in Excell? | Excel Worksheet Functions | |||
Need to change column widths in middle of page. | Excel Discussion (Misc queries) | |||
Excel column widths change on different machines | Excel Programming |