#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Group

I have Name column with corresponding single alphabets in a different column
for each rows
exmaple:

Name
MON Q D C B N
TUE T
WED H U I T R E J L
THU A S L K V X Z W Q I L


I could like to have macro code to combine each column data to a single cell
as shown below, the Column €˜A(Name) will always have a name but the other
columns are not fixed (it can increase or decrease)

Example:
Name
MON Q,D,C,B,N
TUE T
WED H,U,I,T,RE,J,L
THU A,S,L,K,V,X,Z,W,Q,I,L



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Group

This assumes MON is in A1 - change if necessary:

Sub test()

Dim i As Integer, j As Integer
Dim s As String

With Range("A1")
Do Until IsEmpty(.Offset(i, 0))
Do While Not IsEmpty(.Offset(i, j + 1))
s = s & .Offset(i, j + 1).Value & ","
.Offset(i, j + 1).ClearContents
j = j + 1
Loop
If Not s = "" Then .Offset(i, 1).Value = Left(s, Len(s) - 1)
s = ""
j = 0
i = i + 1
Loop

End With

End Sub


"Ranjith Kurian" wrote:

I have Name column with corresponding single alphabets in a different column
for each rows
exmaple:

Name
MON Q D C B N
TUE T
WED H U I T R E J L
THU A S L K V X Z W Q I L


I could like to have macro code to combine each column data to a single cell
as shown below, the Column €˜A(Name) will always have a name but the other
columns are not fixed (it can increase or decrease)

Example:
Name
MON Q,D,C,B,N
TUE T
WED H,U,I,T,RE,J,L
THU A,S,L,K,V,X,Z,W,Q,I,L



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
Range.Group Method - group rows, not columns serhio[_2_] Excel Programming 1 May 7th 08 01:26 PM
Group a range - closing the group does not hide the controls.... [email protected] Excel Programming 0 April 21st 07 04:53 AM
Sort by Group Header or by Group SubHeader Aria[_2_] Excel Programming 4 February 28th 07 01:07 AM
Taking age group Ie ages 20-29 and picking out net sales for group viabello Excel Worksheet Functions 1 April 25th 06 04:19 AM
How do I group worksheets (Lotus 123 function is "Sheet>Group Shee jaking Excel Worksheet Functions 2 August 30th 05 02:09 PM


All times are GMT +1. The time now is 12:46 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"