I have written a very nice little excel add-in which creates a report of all the errors on my workbook and then hyperlinks to them. I have assigned a hotkey to the macro and then saved the workbook as an .xla.
All works fine.
However, I want to add comments in the little comment box in the add-in screen. I thought I could just add a description to the macro but that has not worked.
Any ideas?
Thanks
PS: For anyone that is interested here is my code...
All works fine.
However, I want to add comments in the little comment box in the add-in screen. I thought I could just add a description to the macro but that has not worked.
Any ideas?
Thanks
PS: For anyone that is interested here is my code...
Code:
Sub FindErrorsAndListAddressAddInV7()
Application.ScreenUpdating = True
Dim DivError As Integer
Dim RefError As Integer
Dim MyErrors As Integer
Dim NA_Error As Integer
Dim NameError As Integer
Dim NumError As Integer
Dim NullError As Integer
Dim ValueError As Integer
Dim i As Integer
Dim ErrorCells As Range
Dim TCell As Range
Dim wsh As Worksheet
i = 1
NullError = 0
DivError = 0
ValueError = 0
RefError = 0
NameError = 0
NumError = 0
NA_Error = 0
Set NewSheet = Sheets.Add(Type:=xlWorksheet)
NewSheet.Cells(i, 1).Value = "Error"
NewSheet.Cells(i, 2).Value = "Sheet"
NewSheet.Cells(i, 3).Value = "Cell"
For Each wsh In ActiveWorkbook.Worksheets
Set ErrorCells = Nothing
On Error Resume Next
Set ErrorCells = wsh.Cells.SpecialCells(xlCellTypeFormulas, xlErrors)
On Error GoTo 0
If ErrorCells Is Nothing Then GoTo NextWsh
For Each TCell In ErrorCells.Cells
Select Case TCell.Value
Case CVErr(xlErrDiv0)
DivError = DivError + 1
i = i + 1
NewSheet.Cells(i, 1).Value = TCell.Value
NewSheet.Cells(i, 2).Value = wsh.Name
NewSheet.Cells(i, 3).Value = TCell.Address
Case CVErr(xlErrNA)
NA_Error = NA_Error + 1
i = i + 1
NewSheet.Cells(i, 1).Value = TCell.Value
NewSheet.Cells(i, 2).Value = wsh.Name
NewSheet.Cells(i, 3).Value = TCell.Address
Case CVErr(xlErrName)
NameError = NameError + 1
i = i + 1
NewSheet.Cells(i, 1).Value = TCell.Value
NewSheet.Cells(i, 2).Value = wsh.Name
NewSheet.Cells(i, 3).Value = TCell.Address
Case CVErr(xlErrNull)
NullError = NullError + 1
i = i + 1
NewSheet.Cells(i, 1).Value = TCell.Value
NewSheet.Cells(i, 2).Value = wsh.Name
NewSheet.Cells(i, 3).Value = TCell.Address
Case CVErr(xlErrNum)
NumError = NumError + 1
i = i + 1
NewSheet.Cells(i, 1).Value = TCell.Value
NewSheet.Cells(i, 2).Value = wsh.Name
NewSheet.Cells(i, 3).Value = TCell.Address
Case CVErr(xlErrRef)
RefError = RefError + 1
i = i + 1
NewSheet.Cells(i, 1).Value = TCell.Value
NewSheet.Cells(i, 2).Value = wsh.Name
NewSheet.Cells(i, 3).Value = TCell.Address
Case CVErr(xlErrValue)
ValueError = ValueError + 1
i = i + 1
NewSheet.Cells(i, 1).Value = TCell.Value
NewSheet.Cells(i, 2).Value = wsh.Name
NewSheet.Cells(i, 3).Value = TCell.Address
Case Else
MsgBox "Unidentified error type"
i = i + 1
NewSheet.Cells(i, 1).Value = TCell.Value
NewSheet.Cells(i, 2).Value = wsh.Name
NewSheet.Cells(i, 3).Value = TCell.Address
End Select
Next TCell
NextWsh:
Next wsh
Application.ScreenUpdating = True
NewSheet.Cells(1, 5).Value = "#Null! Errors: " & NullError
NewSheet.Cells(2, 5).Value = "#DIV/0! Errors: " & DivError
NewSheet.Cells(3, 5).Value = "#VALUE! Errors: " & ValueError
NewSheet.Cells(4, 5).Value = "#REF! Errors: " & RefError
NewSheet.Cells(5, 5).Value = "#NAME? Errors: " & NameError
NewSheet.Cells(6, 5).Value = "#NUM! Errors: " & NumError
NewSheet.Cells(7, 5).Value = "#N/A Errors: " & NA_Error
NewSheet.Cells(9, 5).Value = "Total Errors: " & NullError + DivError _
+ ValueError + RefError + NameError + NumError + NA_Error
Ans = MsgBox("Would you like to build hyperlinks to error cells?", vbYesNo, "Link Builder v0.4b")
If Ans = vbYes Then
NewSheet.Range("D1").Value = "Link"
For i = 2 To NewSheet.Range("c65536").End(xlUp).Row
strSubAddress = "'" & Range("b" & i) & "'!" & Range("c" & i)
strDisplayText = Range("b" & i) & Range("c" & i)
NewSheet.Hyperlinks.Add Anchor:=Range("d" & i), Address:="", SubAddress:=strSubAddress, TextToDisplay:=strDisplayText
Next i
Columns("D:D").EntireColumn.AutoFit
End If
Columns("B:B").EntireColumn.AutoFit
Columns("E:E").EntireColumn.AutoFit
End Sub