Cell Wrap

From IARC 207 Wiki
Revision as of 10:33, 12 March 2008 by imported>Bob
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Copy and paste the text in the box into the visual basic editor that comes with Excel. To get access to personal.xls in the visual basic editor check out this article: Save_Macros_in_Excel

This short macro does a cell reformat making the cell text do a word wrap within the cell so you can see it all. Useful for long column headers when you're working with time series data such as met or soil climate data.

option explicit
Sub Cell_Wrap()
' This shorty macro does the wrap text f(x) for cells so you can
' see what's in cells with lots of text.
'
   With Selection
       .HorizontalAlignment = xlGeneral
       .VerticalAlignment = xlBottom
       .WrapText = True
       .Orientation = 0
       .AddIndent = False
       .IndentLevel = 0
       .ShrinkToFit = False
       .ReadingOrder = xlContext
       .MergeCells = False
   End With
End Sub