Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Transform columns with VBA

Hello

I have the following problem that I would like to solve with a VBA-macro

In column A there is a string of letters and/or numbers in every cell, e.g. A1-A6
a
za
b
hg
v
z

I would like to buikd a new column B in the following way: The content of A2 goes behind A1, the content of A3 goes behind A2 and so on

In the exemple above the column B is
abza
zabb
b2hg
hgfv
vaz

Does anybody know a VBA-macro that does this job

Kind regard
Michael E

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Transform columns with VBA

On the offhand chance a simple formula can be used:

in B2 or B1, your choice, but a formula

=A1&A2

then drag fill down the column.

--
Regards,
Tom Ogilvy

"Michael E." wrote in message
...
Hello,

I have the following problem that I would like to solve with a VBA-macro:

In column A there is a string of letters and/or numbers in every cell,

e.g. A1-A6:
ab
zab
b2
hgf
va
zb

I would like to buikd a new column B in the following way: The content of

A2 goes behind A1, the content of A3 goes behind A2 and so on.

In the exemple above the column B is:
abzab
zabb2
b2hgf
hgfva
vazb

Does anybody know a VBA-macro that does this job?

Kind regards
Michael E.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Transform columns with VBA

Hello Tom

since the transformation should be included in an existing VBA macro I need a VBA solution. Do you know how a macro solution

Kind regard
Michae

----- Tom Ogilvy wrote: ----

On the offhand chance a simple formula can be used

in B2 or B1, your choice, but a formul

=A1&A

then drag fill down the column

-
Regards
Tom Ogilv

"Michael E." wrote in messag
..
Hello
I have the following problem that I would like to solve with a VBA-macro
In column A there is a string of letters and/or numbers in every cell

e.g. A1-A6
a
za
b
hg
v
z
I would like to buikd a new column B in the following way: The content o

A2 goes behind A1, the content of A3 goes behind A2 and so on
In the exemple above the column B is

abza
zabb
b2hg
hgfv
vaz
Does anybody know a VBA-macro that does this job
Kind regard

Michael E

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Transform columns with VBA

For i = 1 To 5
Range("B" & i).Value = Range("A" & i).Value & Range("A" & i + 1).Value
Next

Alan Beban

Michael E. wrote:

Hello Tom,

since the transformation should be included in an existing VBA macro I need a VBA solution. Do you know how a macro solution?

Kind regards
Michael

----- Tom Ogilvy wrote: -----

On the offhand chance a simple formula can be used:

in B2 or B1, your choice, but a formula

=A1&A2

then drag fill down the column.

--
Regards,
Tom Ogilvy

"Michael E." wrote in message
...
Hello,
I have the following problem that I would like to solve with a VBA-macro:
In column A there is a string of letters and/or numbers in every cell,

e.g. A1-A6:
ab
zab
b2
hgf
va
zb
I would like to buikd a new column B in the following way: The content of

A2 goes behind A1, the content of A3 goes behind A2 and so on.
In the exemple above the column B is:

abzab
zabb2
b2hgf
hgfva
vazb
Does anybody know a VBA-macro that does this job?
Kind regards

Michael E.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Transform columns with VBA

Sub Concatenate2()
Range("B1:B5").Formula = "=A1&A2"
Range("B1:B5").Formula = Range("B1:B5").Value
End Sub


--
Regards,
Tom Ogilvy


"Michael E." wrote in message
...
Hello Tom,

since the transformation should be included in an existing VBA macro I

need a VBA solution. Do you know how a macro solution?

Kind regards
Michael

----- Tom Ogilvy wrote: -----

On the offhand chance a simple formula can be used:

in B2 or B1, your choice, but a formula

=A1&A2

then drag fill down the column.

--
Regards,
Tom Ogilvy

"Michael E." wrote in message
...
Hello,
I have the following problem that I would like to solve with a

VBA-macro:
In column A there is a string of letters and/or numbers in every

cell,
e.g. A1-A6:
ab
zab
b2
hgf
va
zb
I would like to buikd a new column B in the following way: The

content of
A2 goes behind A1, the content of A3 goes behind A2 and so on.
In the exemple above the column B is:

abzab
zabb2
b2hgf
hgfva
vazb
Does anybody know a VBA-macro that does this job?
Kind regards

Michael E.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 733
Default Transform columns with VBA

"Alan Beban" wrote...
For i = 1 To 5
Range("B" & i).Value = Range("A" & i).Value & _
Range("A" & i + 1).Value
Next

....

Range("B1:B5").Value = Evaluate("=A1:A5&A2:A6")

would be an alternative.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vlookup to transform columns to rows dee Excel Worksheet Functions 2 October 20th 07 09:36 PM
Transform csv to qif or ofx format? Henrik Excel Discussion (Misc queries) 0 March 15th 07 08:45 PM
How I transform a row into a column? Mosqui Excel Discussion (Misc queries) 0 January 19th 07 08:30 PM
How I transform a row into a column? Stefi Excel Discussion (Misc queries) 0 January 19th 07 08:22 PM
Table Transform James Excel Discussion (Misc queries) 3 December 5th 06 07:57 PM


All times are GMT +1. The time now is 09:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"