Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all, I have data in my sheet (see below)
A B C D E………col xx 01 02 06 07 zz 55 90 22 78 tt 15 02 05 09 ss 66 58 02 04 aa 18 20 10 03 I want macro which should combine each row cells value from coloum B to E and put result in coloum F something like this (see below) A B C D E F……col xx 01 02 06 07 01-02-06-07 zz 55 90 22 78 55-90-22-78 tt 15 02 05 09 15-02-05-09 ss 66 58 02 04 66-58-02-04 aa 18 20 10 03 18-20-10-03 macro should put result in column F down to last value cell in column A and macro should make sure that those values in cells which have zero on the start like 01 or 02 when they will get combine by macro they should stay in same format like "01-02" instead of "1-2". I hope I was able to explain my question. Can any friend can help me in this. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Aug 28, 10:33*pm, "Don Guillett" wrote:
Try this Sub putcolstogetherinonecell() Columns("f").ClearContents For i = 2 To Cells(Rows.Count, "a").End(xlUp).Row ms = "" lc = Cells(i, Columns.Count).End(xlToLeft).Column For j = 2 To lc ms = ms & "-" & Cells(i, j) Next j Cells(i, lc + 1) = Right(ms, Len(ms) - 1) Next i End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "K" wrote in message ... Hi all, *I have data in my sheet (see below) * * A * * * *B * * * *C * * * D * * * E………col * * xx * * * 01 * * *02 * * *06 * * * 07 * * zz * * * 55 * * *90 * * *22 * * * 78 * * tt * * * *15 * * * 02 * * *05 * * * 09 * * ss * * * 66 * * *58 * * *02 * * * 04 * * aa * * * 18 * * *20 * * *10 * * * 03 I want macro which should combine each row cells value from coloum B to E and put result in coloum F something like this (see below) * * A * * * *B * * * * *C * * * *D * * * *E * * * * * * F……col * * xx * * * 01 * * * *02 * * * 06 * * * 07 * * * 01-02-06-07 * * zz * * * 55 * * * *90 * * * 22 * * * 78 * * * 55-90-22-78 * * tt * * * *15 * * * *02 * * * 05 * * * 09 * * * 15-02-05-09 * * ss * * * 66 * * * *58 * * * 02 * * * 04 * * * 66-58-02-04 * * aa * * * 18 * * * *20 * * * 10 * * * 03 * * * 18-20-10-03 macro should put result in column F down to last value cell in column A and macro should make sure that those values in cells which have zero on the start like 01 or 02 when they will get combine by macro they should stay in same format like "01-02" instead of "1-2". *I hope I was able to explain my question. Can any friend can help me in this. Thanks Don it works perfect |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to Merge Two Cells IF Another Cell Matches | Excel Worksheet Functions | |||
Merge Cells in a Row to one Cell and text is NOT in a line | Excel Discussion (Misc queries) | |||
How can I merge 3 cells into 1 cell? | Excel Worksheet Functions | |||
merge several cells with text into 1 cell | Excel Discussion (Misc queries) | |||
How do I merge one cell into two cells? | Excel Discussion (Misc queries) |