I’m trying to automatically, using VB.NET, place data which exist in individual columns in two separate files into a third file and then multiply the row elements of each one of these two columns and place the result in a third column. So far I’m doing it by using a loop:
Dim I As Integer
For I = 1 To 20
ObjectWorkSheet.Cells(I, 1) = ObjectCell1(I, 2).Value
ObjectWorkSheet.Cells(I, 2) = ObjectCell2(I, 2).Value
ObjectWorkSheet.Cells(I, 3) = ObjectCell(I, 2).Value * ObjectCell(I, 3).Value
This works fine when you have a few data points. However, it’s excruciatingly slow for a large array, say 10,000 points. I was wondering if there’s a way to make it faster by mimicking what one would actually do manually in Excel to accomplish this task. Can’t there be a way by using VB.NET to copy each one of the columns from the two initial files and then paste it into the third file? Then, once the data in the two new columns are in the newly formed third file, say in columns A and B, can’t VB.NET instruct Excel to have in column C the formula =(A1*B1), then highlight column C and copy the result into the rest of the rows? Thanks in advance for your help.