How can I combined text from several cells into one?

B

Barney

I have many rows of code. They are arranged as a single character per cell.
There are ten cells in a row to make a ten character code/text. I need to
combined the ten character in those ten cells as a single code/text. This
ten ccharacter code/text needs to be placed in the cell to the right.

I need to repete this process on many lines.
 
K

Kenji

Hi Barney,
There are two ways of doing this.

Say you have the cells
A1 = a
B1 = b
C1 = c
and you want D1 to be the string "abc"

1. Excel Functions
make D1 = CONCATENATE(A1,B1,C1)
If you copy and paste D1 down, it'll automatically become =
CONCATENATE(A2,B2,C2)

2. Excel VBA
Press ALT+F11 and open VBA
write a code that will detect the change in columns A B or C and generate D
This will do
Private Sub Worksheet_Change(ByVal Target As Range)
if target.column >= 1 and target.column <=3 then
thisworkbook.sheets("Sheet1").cells(target.row, 4).value =
vba.cstr(thisworkbook.sheets("Sheet1").cells(target.row, 1).value &
vba.cstr(thisworkbook.sheets("Sheet1").cells(target.row, 2).value &
vba.cstr(thisworkbook.sheets("Sheet1").cells(target.row, 3).value
End Sub

I know "thisworkbook" may seem unncessary, but this way it'll work in IE,
mac, whatever you name it.

Kenjiro Yagi
http://www.spoofee.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top