by James Strickland June 17, 2008 1:42 pm
Trying to AutoFormat an Excel Spreadsheet...
Sub OLVIMS_REPORT() '====================================================== ' CLOSED 868 REPORT AUTO FORMAT SCRIPT/MACRO '====================================================== Columns("A:B").Select Selection.Delete Shift:=xlToLeft Range("H1").Select Cells.Replace What:="END OF REPORT", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Range("A2").Select Columns("H:H").EntireColumn.AutoFit Columns("I:I").EntireColumn.AutoFit Columns("C:C").EntireColumn.AutoFit Columns("B:B").EntireColumn.AutoFit Range("A2:I2").Select Selection.Cut Destination:=Range("H1:P1") Range("A4:I4").Select Selection.Cut Destination:=Range("H3:P3") ' the rest was cut out ' ' Delete Blank Rows Macro ' On Error Resume Next Columns("I:I").SpecialCells(xlCellTypeBlanks).EntireRow.Delete ' ' auto_width Macro ' ' Columns("A:Z").EntireColumn.AutoFit ' ' COLOR Macro ' ' Application.ScreenUpdating = False Application.Calculation = xlCalculationManual 'pre XL97 xlManual Dim Rng As Range, ix As Long Set Rng = Intersect(Range("P:P"), ActiveSheet.UsedRange) For ix = Rng.Count To 1 Step -1 If Trim(Replace(Rng.Item(ix).Text, Chr(160), Chr(32))) = "" Then Rng.Item(ix).ClearContents End If Next done: Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True Columns("H:H").SpecialCells(xlCellTypeBlanks).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .COLOR = 65535 .TintAndShade = 0 .PatternTintAndShade = 0 End With Columns("P:P").Select Columns("P:P").SpecialCells(xlCellTypeBlanks).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .COLOR = 65535 .TintAndShade = 0 .PatternTintAndShade = 0 End With End Sub
Here is the full code, in txt format.
Pages
Category
- Aikido (13)
- Family (36)
- General (67)
- Linux (18)
- Computer (3)
- Metal Detecting (1)
- Off Road (7)
- school (15)
- Travel (11)
- Uncategorized (1)
- Web (17)
- WII (2)
- work (22)
Archives
- January 2012
- December 2011
- August 2011
- April 2011
- November 2010
- October 2010
- September 2010
- July 2010
- June 2010
- May 2010
- February 2010
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- December 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- January 2007
- December 2006
- November 2006

Comments are closed.