LutonBarry
03-13-2014, 02:51 PM
Hello hope you can help. I have written some code for a workbook I've named 'WO Report' it is saved as a macro enabled file etc. When I open it I get a message about some unreadable data and do I want to recover it, or some thing like that. Anyway when the file does open it has [Repaired] added to the workbook name in the spreadsheet title bar. This I believe is an excel known fault.
The problem I then encounter is when running the macros it returns a 'Subscript out of range' error when it reaches the last line of the code below. Even if I edit the line and add [Repaired] to the file name in the code it still returns the subscript out of range error. Any ideas folks.
By the way hopefully the code below will appear correctly, apologies if not.
Dim myCheck As Integer
myCheck = MsgBox("Brought to you courtesy of the Luton Outlaws. Locate and open today's Conf Report. Continue?", vbYesNo)
Dim myWorkbook As Workbook
myFile = Application.GetOpenFilename()
Workbooks.Open Filename:=myFile
Set myWorkbook = ActiveWorkbook
Application.Calculation = xlAutomatic
Selection.AutoFilter
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Copy
Windows("WO Report.xlsm").Activate
The problem I then encounter is when running the macros it returns a 'Subscript out of range' error when it reaches the last line of the code below. Even if I edit the line and add [Repaired] to the file name in the code it still returns the subscript out of range error. Any ideas folks.
By the way hopefully the code below will appear correctly, apologies if not.
Dim myCheck As Integer
myCheck = MsgBox("Brought to you courtesy of the Luton Outlaws. Locate and open today's Conf Report. Continue?", vbYesNo)
Dim myWorkbook As Workbook
myFile = Application.GetOpenFilename()
Workbooks.Open Filename:=myFile
Set myWorkbook = ActiveWorkbook
Application.Calculation = xlAutomatic
Selection.AutoFilter
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Copy
Windows("WO Report.xlsm").Activate