LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run Time Error 9

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM
Run-time error '11' & Run-time error '1004' Piers Clinton-Tarestad Excel Programming 0 January 9th 04 08:35 PM


All times are GMT +1. The time now is 04:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"