So I am assuming I am missing something basic as this is supposed to be a very simple operation.
I have a collection of items that I have cleaned and prepared to write on the first 3 columns of the second sheet.
When I execute this loop, CPU usage goes through the roof and it freezes Excel.
I tested using numbers instead of the function calls but that is not the problem, it's the actual write operation. If I debug and run it manually, it goes very slow and if I try to write more than 1 data every second it starts "lagging". I am assuming I am doing something very stupid. Please help.
I have a collection of items that I have cleaned and prepared to write on the first 3 columns of the second sheet.
When I execute this loop, CPU usage goes through the roof and it freezes Excel.
I tested using numbers instead of the function calls but that is not the problem, it's the actual write operation. If I debug and run it manually, it goes very slow and if I try to write more than 1 data every second it starts "lagging". I am assuming I am doing something very stupid. Please help.
Excel Formula:
Function WriteData(cleanCollection As Collection)
Application.ScreenUpdating = False
lineCount = 1
Sheets(2).Cells.ClearContents
For Each e In cleanCollection
Sheets(2).Cells(lineCount, 1) = e.GetDate()
Sheets(2).Cells(lineCount, 2) = e.GetHour()
Sheets(2).Cells(lineCount, 3) = e.GetCmd()
lineCount = lineCount + 1
Next
End Function