Copying a range from one workbook to another workbook
Oops forgot to show the error message that I'm getting.
'Run time Error "438"
Object doesn't support this property or method
See line that says 'Error happens at next line'
Steve
"caldog" wrote:
I know there is probably a simple answer to this problem, but fot the life of
me, I can't find it.
Here is my code:
Private Sub SingleValues_Click()
Workbooks.Open Filename:="C:\Excel\Data1.xls"
'Refresh Data
'Sheets("Singles").Select
'Selection.QueryTable.Refresh BackgroundQuery:=False
'Sheets("Doubles").Select
'Selection.QueryTable.Refresh BackgroundQuery:=False
'Copy Data
Windows("Data1.xls").Activate
Sheets("Singles").Select
Range("A9:F51").Copy
Windows("Data2.xls").Activate
Sheets("Single Game Stats").Select
'Error happens at next line
Range("A9:F51").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
'Sort Download
Windows("Jai-Alai.xls").Activate
Worksheets("Single Game Stats").Range("A9:F51").Select
Selection.Sort Key1:=Range("B9"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Windows("Data1.xls").Activate
ActiveWorkbook.Close
End Sub
Thanks for the help
Steve
|