B
Bankonit9
Could anyone please explain why would I get a Run Time Error 9 with
this code?
Sub submit_roster()
Dim myName As String
Dim myFile As String
Dim myWeek As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False
myFile = ActiveWorkbook.Name
myName = ActiveSheet.Name
myDate = Range("C5").Value
myName = myName & ". " & myDate
If Range("C5").Value = "" Then
MsgBox ("Pick a week to submit from the dropdown list.")
Range("C5").Select
Else
Range("C10:C192").Select
ActiveSheet.Unprotect Password:="richmond"
Selection.locked = True
ActiveSheet.Protect Password:="richmond"
Range("C5").Select
myCheck = vbIgnore
myCheck = MsgBox("Your " & myDate & " roster is now saved.
Are you ready to finalize by sending it to the league?", vbYesNo)
If myCheck = vbYes Then
Workbooks.Add
Sheets(Array("Sheet2", "Sheet3")).Select
ActiveWindow.SelectedSheets.Delete
ActiveWorkbook.SaveAs myName & ".xls"
Windows(myFile).Activate
Cells.Copy
Windows(myName).Activate
ActiveSheet.Paste
ActiveSheet.Name = Range("C5").Value & " Roster
Submission"
Range("C5").Select
Selection.locked = True
ActiveSheet.Protect Password:="richmond"
ActiveWorkbook.Save
MsgBox ("The file '" & myName & "' has been created and
saved in " & ActiveWorkbook.Path & ". Please attach it in an email
and send it to the league distribution list.")
Else
MsgBox ("Your submission file was not created.")
Range("C5").Select
End If
End If
Application.ScreenUpdating = True
End Sub
this code?
Sub submit_roster()
Dim myName As String
Dim myFile As String
Dim myWeek As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False
myFile = ActiveWorkbook.Name
myName = ActiveSheet.Name
myDate = Range("C5").Value
myName = myName & ". " & myDate
If Range("C5").Value = "" Then
MsgBox ("Pick a week to submit from the dropdown list.")
Range("C5").Select
Else
Range("C10:C192").Select
ActiveSheet.Unprotect Password:="richmond"
Selection.locked = True
ActiveSheet.Protect Password:="richmond"
Range("C5").Select
myCheck = vbIgnore
myCheck = MsgBox("Your " & myDate & " roster is now saved.
Are you ready to finalize by sending it to the league?", vbYesNo)
If myCheck = vbYes Then
Workbooks.Add
Sheets(Array("Sheet2", "Sheet3")).Select
ActiveWindow.SelectedSheets.Delete
ActiveWorkbook.SaveAs myName & ".xls"
Windows(myFile).Activate
Cells.Copy
Windows(myName).Activate
ActiveSheet.Paste
ActiveSheet.Name = Range("C5").Value & " Roster
Submission"
Range("C5").Select
Selection.locked = True
ActiveSheet.Protect Password:="richmond"
ActiveWorkbook.Save
MsgBox ("The file '" & myName & "' has been created and
saved in " & ActiveWorkbook.Path & ". Please attach it in an email
and send it to the league distribution list.")
Else
MsgBox ("Your submission file was not created.")
Range("C5").Select
End If
End If
Application.ScreenUpdating = True
End Sub