P
Paul Leonard
The routine below will crash Excel XP at the last open. Same with
xlPasteSpecialOperationMultiply.
Works in Excel 2003, but if you then manually close the test.xls workbook
from the File menu, Excel will crash. Workbooks.Close works, though.
No problems doing any of this in Excel 2000.
Sub test()
Workbooks.Add (xlWorksheet)
ActiveWorkbook.SaveAs Filename:="c:\temp\test.xls"
Cells(3, 1) = 1
For i = 2 To 11
Cells(1, i) = i - 1
Cells(2, i) = "=" & Cells(1, i).Address(ColumnAbsolute:=False)
Cells(3, i) = "=" & Cells(3, i - 1).Address(RowAbsolute:=False,
ColumnAbsolute:=False)
Next
Range("B2:K2").Select
Selection.Copy
Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteFormulas,
Operation:=xlPasteSpecialOperationAdd
Workbooks("test.xls").Close Savechanges:=True
Workbooks.Open "c:\temp\test.xls"
Range("B2:K2").Select
Selection.Copy
Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteFormulas,
Operation:=xlPasteSpecialOperationAdd
Workbooks("test.xls").Close Savechanges:=True
Workbooks.Open "c:\temp\test.xls"
End Sub
This kind of operation is blowing up at one of our client sites after they
upgraded from Excel 2000 to Excel 2003 - is there a fix or workaround for
this?
Thanks,
ptl
xlPasteSpecialOperationMultiply.
Works in Excel 2003, but if you then manually close the test.xls workbook
from the File menu, Excel will crash. Workbooks.Close works, though.
No problems doing any of this in Excel 2000.
Sub test()
Workbooks.Add (xlWorksheet)
ActiveWorkbook.SaveAs Filename:="c:\temp\test.xls"
Cells(3, 1) = 1
For i = 2 To 11
Cells(1, i) = i - 1
Cells(2, i) = "=" & Cells(1, i).Address(ColumnAbsolute:=False)
Cells(3, i) = "=" & Cells(3, i - 1).Address(RowAbsolute:=False,
ColumnAbsolute:=False)
Next
Range("B2:K2").Select
Selection.Copy
Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteFormulas,
Operation:=xlPasteSpecialOperationAdd
Workbooks("test.xls").Close Savechanges:=True
Workbooks.Open "c:\temp\test.xls"
Range("B2:K2").Select
Selection.Copy
Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteFormulas,
Operation:=xlPasteSpecialOperationAdd
Workbooks("test.xls").Close Savechanges:=True
Workbooks.Open "c:\temp\test.xls"
End Sub
This kind of operation is blowing up at one of our client sites after they
upgraded from Excel 2000 to Excel 2003 - is there a fix or workaround for
this?
Thanks,
ptl