-
Some suggestions to streamline your code. Avoid Activate and Select
[vba]
'For
Range("A1:L1").Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With
'Use
With Range("A1:L1")
.Font.Bold = True
.Interior.ColorIndex = 15
End With
'For
Columns("F:F").Select
Selection.Cut
Columns("D
").Select
Selection.Insert Shift:=xlToRight
'Use
Columns("F:F").Cut
Columns("D
").Insert
'Make sure sheet name doesn't contain illegal Characters (Rev 3)
KillColon:
intPosition = InStr(strPart, ":")
If intPosition > 0 Then
strPart = Left(strPart, intPosition - 1) & Right(strPart, Len(strPart) - intPosition)
GoTo KillColon
End If
'Try
Dim Illegals, Illeg
Illegals = Array(":", "\", "/") 'etc. add the rest
For Each Illeg In Illegals
strPart = Application.Substitute(strPart, Illeg, "")
Next
[/vba]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules