Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Visual Basic Error Run Time Error, Type Mismatch | Excel Discussion (Misc queries) | |||
Run time error 1004, General ODBC error | New Users to Excel | |||
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error | Excel Programming | |||
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) | Excel Programming | |||
Run-time error '11' & Run-time error '1004' | Excel Programming |