I have created a vba program in Excel 2007 on a 32bit XP machine that runs without error. However when I try to run the same spreadsheet on a 64bit Server 2008 R2 Remote desktop services machine, I receive an unrecoverable error. Here is the code that is causing the trouble:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrHandle
Dim MachPhone As String
Dim ConPhone As String
Select Case Target.Row
Case 12
MachPhone = PhoneFormat(Range("B12"))
Range("B12").Value = MachPhone
Case 13
ConPhone = PhoneFormat(Range("B13"))
Range("B13").Value = ConPhone
End Select
ErrHandle:
Exit Sub
Resume
End Sub
The PhoneFormat function checks the format of a phone number and returns a formated phone number or the original string, if it can't figure out what the phone number is.
Disabling events: