Hey all, I was wrong. The macro was working on some files but not others.
This is my macro I'm running to open the xls, make some modifications, close and save the xls. However, I'm getting a failure and the macro won't run on 99% of the xls sheets. I think its because they were converted from HTML into xls. Is there a way to tell my code when trying to open a sheet, if you get an error click ok, and then execute macro?
Sub New_Clean()
'
' Macro2 Macro
'
Dim PathName As String
Dim FileName As String
Dim CurrentWB As Workbook
Dim Pic As Object
PathName = "C:\BoxScoreTest\"
FileName = Dir(PathName & "*.xls")
Do While FileName <> ""
Set CurrentWB = Workbooks.Open(PathName & FileName)
With CurrentWB.ActiveSheet
.Rows("1:30").Delete Shift:=xlUp
With .UsedRange.Font
.Name = "Verdana"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
.ColorIndex = xlAutomatic
For Each Pic In ActiveSheet.Pictures
Pic.Delete
Next Pic
ActiveWindow.SmallScroll Down:=-120
Range("A1:BR500").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.Delete Shift:=xlToLeft
Columns("I:BX").Select
Selection.Delete Shift:=xlToLeft
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
End With
End With
CurrentWB.Close True
FileName = Dir()
Loop
End Sub
Bookmarks