Difference between revisions of "Cell Wrap"

From IARC 207 Wiki
Jump to navigation Jump to search
imported>Bob
 
imported>Bob
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
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]]
+
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.
+
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.  Once you've added this macro to your library you may also find it useful to create a [[Tool Bar Button|menu button]] for it.  
  
 
  option explicit
 
  option explicit

Latest revision as of 11:29, 12 March 2008

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. Once you've added this macro to your library you may also find it useful to create a menu button for it.

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