# Simple (I hope) Excel macro question.

**URL:** <https://boards.straightdope.com/t/simple-i-hope-excel-macro-question/436857>\
**Category:** Factual Questions\
**Created:** [February 8, 2008, 10:27pm UTC](https://boards.straightdope.com/t/simple-i-hope-excel-macro-question/436857 "2008-02-08T22:27:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Larry\_Mudd](https://avatars.discourse-cdn.com/v4/letter/l/f14d63/32.png) [@Larry\_Mudd](https://boards.straightdope.com/u/Larry_Mudd)\
**Post date:** [February 8, 2008, 10:27pm UTC](https://boards.straightdope.com/t/simple-i-hope-excel-macro-question/436857/1 "2008-02-08T22:27:49Z")

</div>

Supposing you need to go through a column of numbers and insert a (constant) alpha prefix to each number, how could you do this with VB?

Say column “B” contains these values:

B1=“4”  
B2= “8”  
B3=“15”  
B4=“16”  
B5=“23”  
B6=“42”

(and so on for 20,000 rows or so)

What I want is for the column to contain _these_ alphanumeric values:

B1=“X4”  
B2=“X8”  
B3=“X15”  
B4=“X16”  
B5=“X23”  
B6=“X42”

…and so on. Just an “X” in front of the original numbers.

I am embarrassed to ask for help with this, but I think I’m getting stuck on the numeric --\> alphanumeric thing.

Thanks!

---

<div class="post-metadata">

**Author:** ![Kid\_A\_1](https://avatars.discourse-cdn.com/v4/letter/k/ed8c4c/32.png) [@Kid\_A\_1](https://boards.straightdope.com/u/Kid_A_1)\
**Post date:** [February 8, 2008, 10:42pm UTC](https://boards.straightdope.com/t/simple-i-hope-excel-macro-question/436857/2 "2008-02-08T22:42:36Z")

</div>

Couldn’t you just use the CONCATENATE function?

---

<div class="post-metadata">

**Author:** ![Larry\_Mudd](https://avatars.discourse-cdn.com/v4/letter/l/f14d63/32.png) [@Larry\_Mudd](https://boards.straightdope.com/u/Larry_Mudd)\
**Post date:** [February 8, 2008, 11:15pm UTC](https://boards.straightdope.com/t/simple-i-hope-excel-macro-question/436857/3 "2008-02-08T23:15:31Z")

</div>

:smack:

Yes, that works fine, individually. I still can’t quite work out how to do this simple operation on all the cells in the column, though.

---

<div class="post-metadata">

**Author:** ![Larry\_Mudd](https://avatars.discourse-cdn.com/v4/letter/l/f14d63/32.png) [@Larry\_Mudd](https://boards.straightdope.com/u/Larry_Mudd)\
**Post date:** [February 8, 2008, 11:28pm UTC](https://boards.straightdope.com/t/simple-i-hope-excel-macro-question/436857/4 "2008-02-08T23:28:54Z")

</div>

Hallelujah, the idjit figured it out.

Thank you, **Kid\_A**. That was actually white-light helpful. (I was trying to do it a much more complicated way.)
