I can create a long string variable in VBA by repeatedly appending short string variables like this:
sMyShortString = "a"
For i = 1 to 100
sMyLongString = sMyLongString & sMyShortString
Next i
This works nice and quick, but a weird thing happens when you get to a string length of around 270,000 - the rate at which the code runs suddenly drops by a factor of 10.
I have tested this on Excel 2010 and Excel 2016 on a variety of machines, and the performance hit always happens at the same string length.
Does anyone know why this happens?