I have some large data sets that I am automating and distributing. I want to eliminate the little green triangles that warn the user about numbers stored as text. I have use
You can use workbook events to turn on and off the user's system setting, and restore the setting back to the original value when you're done.
In the ThisWorkbook object, put an Open event that takes note of their initial setting and then turns it off.
Dim MyErrorCheckValue as Boolean
Private Sub Workbook_Open()
MyErrorCheckValue = Application.ErrorCheckingOptions.NumberAsText
Application.ErrorCheckingOptions.NumberAsText = False
End Sub
Add a BeforeClose event to set it back to original value when closing the file.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ErrorCheckingOptions.NumberAsText = MyErrorCheckValue
End Sub
Then add Activate and Deactivate events so it switches when the user opens or views a different spreadsheet.
Private Sub Workbook_Activate()
Application.ErrorCheckingOptions.NumberAsText = False
End Sub
Private Sub Workbook_Deactivate()
Application.ErrorCheckingOptions.NumberAsText = MyErrorCheckValue
End Sub
You could add similar events at the sheet level to turn it on and off when switching sheets within the workbook.
Would also be wise to add some error handling that sets it back to original value so you don't accidentally leave it in the wrong state in the unlikely event that your code bugs out somewhere.