Copy one string to an other, one character at a time

chuckchuckit

Well-known Member
Joined
Sep 18, 2010
Messages
541
Code below does not append 2nd copied character. I need it to append to StringTwo, instead of overwriting.
Code:
Dim StringOne, StringTwo
StringOne = "Word"
 
StringTwo = Mid(StringOne, 1, 1) 'This copies the 1st character OK
StringTwo = Mid(StringOne, 2, 1) 'This copies the 2nd character OK
I will be doing other things to StringTwo inbetween each character like adding an other character or space. And is the reason I need to know how to "append" one character at a time.
Thanks.

Chuck
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hello chuckchuckit,

You can append the second character like this...
Code:
StringTwo = StringTwo & Mid(StringOne, 2, 1)</pre>

By the way, your signature looks like reMorse, is it?

Sincerely,
Leith Ross
 
Upvote 0
Your code works great. Knew it had to be something simple I was not finding.

LOL --wouldn't say reMorse, but perhaps VBAMorse (for Excel).

Appreciate your code. No reMorse there...

Thanks much!

Chuck
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top