![]() |
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 |
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. |
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 |
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. |
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. |
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. |
All times are GMT +1. The time now is 04:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com