Excel VBA : Changing string in cells

Posted by user1265125 on Stack Overflow See other posts from Stack Overflow or by user1265125
Published on 2012-03-30T17:12:03Z Indexed on 2012/03/30 17:29 UTC
Read the original article Hit count: 178

Filed under:
|
|

I have cells with data like these:

ABCD123XYZ
MPOP345MLU .
.
.
.

What I want to do is, to remove the 3rd and 4th character from all these cells, hence giving

AB123XYZ
MP345MLU

How do I do this in VBA?

I have no idea about this language, and if someone can guide me in the right direction, it'd be great :)

I understand I have to:
1. Declare 2 string variables st1 and st2
2. Store data from cell A1 into the variable st1
3. Copy all but the 2nd and 3rd char into str2
4. Output Str2 into B1
5. Move to A2

© Stack Overflow or respective owner

Related posts about vba

Related posts about macros