I created a macro in Excel that works great. It formats multiple sheets exactly as expected, but when it completes it seems like I have to close out four or five worksheets before I can close out of excel completely.
One item of note: I experienced errors when I first built the macro. When I went in to edit the macro, I noticed a ton of temp macros that were never there before. Could I assume this is the problem? Has anyone heard of such a problem? Would it be safe to delete all the temp macros that seem to be hung up?
Here is the code:
Expand|Select|Wrap|Line Numbers
- Sub VVStats()
- '
- ' VVStats Macro
- ' modified weekly VV stats excel for DP3
- Dim ws As Worksheet
- For Each ws In Sheets
- ws.Activate
- Cells.Select
- With Selection.Font
- .Name = "Arial"
- .Size = 11
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ThemeColor = xlThemeColorLight1
- .TintAndShade = 0
- .ThemeFont = xlThemeFontNone
- End With
- With Selection.Font
- .Name = "Arial"
- .Size = 8
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ThemeColor = xlThemeColorLight1
- .TintAndShade = 0
- .ThemeFont = xlThemeFontNone
- End With
- Rows("1:1").Select
- Selection.Font.Bold = True
- Rows("1:1").Select
- With ActiveWindow
- .SplitColumn = 0
- .SplitRow = 1
- End With
- If Not ActiveSheet.AutoFilterMode Then
- ActiveSheet.Range("A1").AutoFilter
- End If
- Cells.EntireColumn.AutoFit
- Cells.EntireRow.AutoFit
- ActiveWindow.FreezePanes = True
- Next ws
- End Sub
UTS