I don't know if this is possible for what you are doing, but could you format a string of text, put it on the clipboard, then paste it into Excel. I once had an excel process that took about 2 minutes, setting each cell, when I started generating a string out of the data and pasting into excel, the time went down to seconds.
Here is the code I used to generate my string. I was displaying the info on a MSFlexGrid so it was easy to generate a string and port it to excel.
Code:
Private Sub CopyData()
Dim strData As String
Dim nRowIndex As Integer
Dim nColIndex As Integer
strData = ""
Clipboard.Clear
For nRowIndex = 0 To grdDisplay.Rows - 1
For nColIndex = 0 To grdDisplay.Cols - 1
strData = strData & grdDisplay.TextMatrix(nRowIndex, nColIndex) & vbTab ' Delimit with tabs
Next nColIndex
strData = Mid(strData, 1, Len(strData) - 1) ' Delete last tab char
strData = strData & vbCrLf ' Delimit new rows with new line
Next nRowIndex
Clipboard.SetText strData ' Copy it to clipboard
End Sub
Unfortunately, the code for the paste I don't have now. however, I have it in .NET.
Code:
Public Sub PasteData(ByVal Value As String)
mvarExcel.ActiveSheet.Range("A1").Select()
mvarExcel.ActiveSheet.Paste()
End Sub
Where mvarExcel is...
Private mvarExcel As Excel.Application
You might not even have to make changes for it. Just start excel, select the cell you want to paste into and do the paste. VBTab should put it in different columns, and vbcrlf for new rows.
Bookmarks