VBA to Copy & Paste Values Suddenly Returns &H8000FFF (-2147418113) Catastrophic Failure
I've had the following code attached to a command button for some years now and until today it has worked fine:
Sub ConvertToValues()
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "Select range to convert to values:"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Application.ScreenUpdating = False
For Each Rng In WorkRng
Rng.Value = Rng.Value
Next
Application.ScreenUpdating = True
End Sub
Sub unprotect_or_protect()
If ActiveSheet.ProtectContents = True Then
ActiveSheet.Unprotect
Else
ActiveSheet.Protect
End If
End Sub
Last time I used it will have been at the start of April.
It's in Module 1.
I can't debug - trying to do so causes the program to crash.
I can live without it, so it's not a problem if nobody knows what the issue might be, but I just wondered if any VBA gurus could spot anything there that might no longer be compatible with the latest version of 365 (I'm on the beta channel).
As I say - this isn't a biggie, so I'm not going to spend time trying to diagnose it if nothing jumps out at anybody, but thanks for any insight. I can't share the workbook and won't be creating a sample, as I can live without this, as I said.
Bookmarks