Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel autoformat

Status
Not open for further replies.

scrappe7

Technical User
Jul 30, 2001
82
US
IS there anyway to apply formatting changes automatically to an excel spreadsheet. I import from access to excel and then always have to resize 20+ columns of info to see everything in each cell. Can an optin be set that will automatically fix this problem.

Thanks,

Ed
 
Hmmm. Ed, try this:

ctrl-a
Format-Column-Autofit selection


Will that work? Perhaps you need to record a macro? Let us know. dreamboat@nni.com
Brainbench MVP for Microsoft Word
 
this is what i ended up using, vb not manual. i ahve 2 ways to do it if anyone wants to see

Sub ChooseAll()
ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Select
Range(ActiveCell, "a1").Select
End Sub

Sub AutoSize()
ChooseAll
With Selection
.EntireRow.Select
.Columns.AutoFit
.EntireColumn.Select
.Rows.AutoFit
End With
End Sub



'THIS IS SAMPLE CODE TO MANUALLY SET WIDTH AND LENGTH SIZE INSTAED OF AUTOFIT

'Sub Format()
'Columns("A:A").Select
'Selection.ColumnWidth = 5
'Columns("B:B").Select
'Selection.ColumnWidth = 10.2
'Columns("C:C").Select
'Selection.ColumnWidth = 5.71
'Columns("D:D").Select
'Selection.ColumnWidth = 19.86

'[copy from above to add code for remaining Columns here]

'Rows("1:1").Select
'Selection.RowHeight = 7.7
'Rows("2:2").Select
'Selection.RowHeight = 8
'Rows("3:3").Select
'Selection.RowHeight = 7.25

'[copy from above to add code for remaining Rows here]
'End Sub

'Adjust the Widths and Heights to match your constraints
'and fill in each of your remaining Rows and CoIumns;
'making sure that you take out the lines in square
'brackets before you finish.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top