ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Stringbuilder (https://www.excelbanter.com/excel-programming/384956-vba-stringbuilder.html)

David G[_4_]

VBA Stringbuilder
 
Hello,

I am just wondering if it is somehow possible to use any sort of
Stringbuilder class in VBA for excel macros to speed up multiple
string concatenations. And if so, how?

David


Don Guillett

VBA Stringbuilder
 

not sure what you're talking about but

Sub makestring()
For Each c In range("d2:d15")
If c < "" Then ms = ms & "," & c
Next c
MsgBox Right(ms, Len(ms) - 1)
End Sub

--
Don Guillett
SalesAid Software

"David G" wrote in message
oups.com...
Hello,

I am just wondering if it is somehow possible to use any sort of
Stringbuilder class in VBA for excel macros to speed up multiple
string concatenations. And if so, how?

David




[email protected][_2_]

VBA Stringbuilder
 

Dynamically you can create arrays and concatenate them using join :

Sub f()
a = Array("asdfa", "sfasdfa")
d = Join(a, ";")
MsgBox d
End Sub


Tim Williams

VBA Stringbuilder
 
Here is a VB implementation which I've used in the past and is easily converted to VBA - works very well.

http://www.awprofessional.com/articl...p?p=25175&rl=1

--
Tim Williams
Palo Alto, CA


"David G" wrote in message oups.com...
Hello,

I am just wondering if it is somehow possible to use any sort of
Stringbuilder class in VBA for excel macros to speed up multiple
string concatenations. And if so, how?

David




Tim Williams

VBA Stringbuilder
 
I also seem to recall comparing the string builder class (see other post) with writing the info directly to a local file and the
file approach won hands down.

--
Tim Williams
Palo Alto, CA


"David G" wrote in message oups.com...
Hello,

I am just wondering if it is somehow possible to use any sort of
Stringbuilder class in VBA for excel macros to speed up multiple
string concatenations. And if so, how?

David





All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com