Newbie: Error 1004
Tom,
I created a test procedure as below and it returned the error mentioned.
Private Sub Command2_Click()
Dim xlApp As Excel.Application
Dim wb As Workbook
Dim ws As Worksheet
Set xlApp = New Excel.Application
Set wb = xlApp.Workbooks.Open("C:\Documents and Settings\My
Documents\Finals.xls")
Set ws = wb.Worksheets("Singles")
xlCol = 24
xlRow = 6
numrw = UBound(Scores, 1) - LBound(Scores, 1) + 1
numcol = UBound(Scores, 2) - LBound(Scores, 2) + 1
Range(xlRow, xlCol ).Resize(numrw, numcol).Value = Scores
wb.SaveAs "C:\Documents and Settings\My Documents\Finals.xls"
wb.Close
xlApp.Quit
Set ws = Nothing
Set wb = Nothing
Set xlApp = Nothing
End Sub
Am trying to save a numeric array, Scores(9,23) to a block of cells
starting at X6.
Regards
Barry
"Tom Ogilvy" wrote in message
...
Sure. In the code you posted, you are working with another excel
application instance - it is unclear why or what application is running
your
code, but you would have to incorporate my suggestion in your code so it
is
properly qualified. Otherwise you might get '1004 - Method 'Range' of
Object'_Global' failed because your unqualified references are
inconsistent
with what you are trying to do.
You didn't post your revision, so no specific suggestion can be offered.
--
Regards,
Tom Ogilvy
|