L
~L
The code
If Worksheets("cover sheet").Range("H7") <> "" And Worksheets("cover
sheet").Range("O10") <> "" And Worksheets("cover sheet").Range("E11") <> ""
Then
If Len(Dir(mypath & myname & ".xls")) = 0 Then
Application.DisplayAlerts = False
Workbooks.Add
ActiveWorkbook.SaveAs Filename:=mypath & myname & ".xls"
Windows("Script with Macros.xls").Activate
Cells.Select
Selection.Copy
Windows(myname & ".xls").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Sheets.Add After:=Sheets(Sheets.Count)
Windows("Script with Macros.xls").Activate
Sheets("DIST " & mq).Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Windows(myname & ".xls").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Dist 17, 67, 196"
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Cover Sheet"
Application.CutCopyMode = False
ActiveWorkbook.Save
ActiveWorkbook.Close
Sheets("Cover Sheet").Select
Application.DisplayAlerts = True
End If
End If
Halts just after executing:
Sheets("DIST " & mq).Select
and produces the runtime 1004 error.
I'm having difficulty understanding why.
Any thoughts?
If Worksheets("cover sheet").Range("H7") <> "" And Worksheets("cover
sheet").Range("O10") <> "" And Worksheets("cover sheet").Range("E11") <> ""
Then
If Len(Dir(mypath & myname & ".xls")) = 0 Then
Application.DisplayAlerts = False
Workbooks.Add
ActiveWorkbook.SaveAs Filename:=mypath & myname & ".xls"
Windows("Script with Macros.xls").Activate
Cells.Select
Selection.Copy
Windows(myname & ".xls").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Sheets.Add After:=Sheets(Sheets.Count)
Windows("Script with Macros.xls").Activate
Sheets("DIST " & mq).Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Windows(myname & ".xls").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Dist 17, 67, 196"
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Cover Sheet"
Application.CutCopyMode = False
ActiveWorkbook.Save
ActiveWorkbook.Close
Sheets("Cover Sheet").Select
Application.DisplayAlerts = True
End If
End If
Halts just after executing:
Sheets("DIST " & mq).Select
and produces the runtime 1004 error.
I'm having difficulty understanding why.
Any thoughts?