I am getting a debug at the End If right after ActiveWorkbook.Save. I don't have to do any thing but hit F5 and it finishes. Any suggestions? I need to get this to end users in the next few minutes.
Using Excel 2013 on Win 8 this is the complete piece of code
Using Excel 2013 on Win 8 this is the complete piece of code
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Application.ScreenUpdating = False
Dim uName As String
uName = Environ("username")
Application.EnableEvents = False
If uName = "cwoolno" Then
Dim anSwers As Integer
anSwers = MsgBox("Do you want to copy?", vbYesNo)
If anSwers = vbNo Then
GoTo noupdate2
Else
ActiveSheet.Unprotect
Sheets("bkup").Visible = True
Sheets("Win10").Select
Cells.Select
Selection.Copy
Sheets("bkup").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("bkup").Select
'ActiveWindow.SelectedSheets.Visible = False
Sheets("Win10").Select
Range("B2").Select
Application.CutCopyMode = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFiltering:=True
ActiveWorkbook.Save
'This is where the error happens
End If
noupdate2:
End If
Application.EnableEvents = True
End Sub