I am currently working on my first ever VBA macro to run the functions described in the title. I currently have the following code.
It appears to be working as intended, but I would love a second set of eyes to tell me if I have any unintended consequences or if there are more stable ways to write this. Thanks in advance, KP.
'
' deletecomments Macro
' delete comments, removetabs, break links for rolling models
'
' Keyboard Shortcut: Ctrl+alt+R
'
Public Sub RollModel()
Dim ws As Worksheet, cmt As Comment
For Each ws In ActiveWorkbook.Worksheets
For Each cmt In ws.Comments
cmt.Delete
Next cmt
Next ws
On Error Resume Next
For Each it In ThisWorkbook.LinkSources
For Each sh In Sheets
sh.Cells.Replace it, ""
For Each cl In sh.UsedRange.SpecialCells(-4174)
If InStr(cl.Validation.Formula1, "#REF") Then cl.Validation.Delete
Next
Next
ThisWorkbook.BreakLink it, 1
Next
Application.DisplayAlerts = False
Dim Sht As Worksheet
For Each Sht In Worksheets
If Sht.Tab.ColorIndex = xlColorIndexNone Then Sht.Delete
Next
Application.DisplayAlerts = True
End Sub