My code is always error-ing at the comment section in the code below.
Code:
Public Sub formatExcelReports(ByRef myDict As Dictionary)
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Dim xlWbk As Object
Dim Key As Variant
Dim ws As Object
For Each Key In myDict.Keys
Debug.Print Key & vbTab & dict(Key)
Set xlWbk = xlApp.workbooks.Open(Key, False, False)
For Each ws In xlWbk.sheets
With ws.cells
.Font.Name = "Arial"
.Font.Size = 10
End With
On Error GoTo eh
ws.Range("A1:" & Split(ws.Range("A1").end(xlToRight), "$")(1) & 1).Interior.Color = RGB(191, 191, 191) 'here it goes to the error handler
Next
Next
eh:
MsgBox "error"
Resume Next
End Sub