KillGorack
New Member
- Joined
- Jan 23, 2006
- Messages
- 35
- Office Version
- 2016
- Platform
- Windows
Hi,
I have a macro that just grabs data from one sheet, does a little formatting, and places that data into another..
In the attachment the first column is the time it takes to read the data into a 2D dictionary, and the second column is the time it takes to place it into ThisWorkbook
the code below is the portion where it's written.
Runs slow as heck the first time, and quickly after.. I think it's a cache thing, but don't know how to get around it.
Any ideas on how to speed this up on first use?
I have a macro that just grabs data from one sheet, does a little formatting, and places that data into another..
In the attachment the first column is the time it takes to read the data into a 2D dictionary, and the second column is the time it takes to place it into ThisWorkbook
the code below is the portion where it's written.
Runs slow as heck the first time, and quickly after.. I think it's a cache thing, but don't know how to get around it.
Any ideas on how to speed this up on first use?
VBA Code:
s = Timer()
xcursor = 2
For Each pkey In topics.Keys
ycursor = 1
For Each ckey In topics(pkey)
If ckey = 0 Then
ThisWorkbook.Sheets("Data").Range("A" & xcursor & ":T" & xcursor).Interior.ColorIndex = topics(pkey)(ckey)
Else
ThisWorkbook.Sheets("Data").Cells(xcursor, ycursor - 1).value = topics(pkey)(ckey)
End If
ycursor = ycursor + 1
Next ckey
xcursor = xcursor + 1
Next pkey
timertempheight = ThisWorkbook.Sheets("Timer").Cells(Rows.Count, 2).End(xlUp).Row
ThisWorkbook.Sheets("Timer").Cells(timertempheight + 1, 2).value = Timer() - s