Hello,
I need a macro that takes the selected cells values in a column and makes a single cell with comma separated values
example
45
48
50
55
60
Should look like this:
45, 48, 50, 55, 60
If anyone can help me i would be very happy!
/m
Hello,
I need a macro that takes the selected cells values in a column and makes a single cell with comma separated values
example
45
48
50
55
60
Should look like this:
45, 48, 50, 55, 60
If anyone can help me i would be very happy!
/m
![]()
Function MyConCat(MyRng As Range) As String For Each Ccell In MyRng MyConCat = MyConCat & ", " & CStr(Ccell) Next MyConCat = Mid(MyConCat, 3) End Function
Looking for great solutions but hate waiting?
Seach this Forum through Google
www.Google.com (e.g. +multiple +IF site:excelforum.com/excel-general/ )
www.Google.com (e.g. +fill +combobox site:excelforum.com/excel-programming/ )
Ave,
Ricardo
Or
![]()
Sub concat() Dim LR As Long LR = Range("A" & Rows.Count).End(xlUp).Row Range("B1").Value = Join(Application.Transpose(Range("A1:A" & LR)), ", ") End Sub
Thanks both of you for really quick answer.
Is there a way to get the result of the script in the top cell of the selected range?
EDIT: the vba script does not seem to work like intended. I select cells, but it generates values from other places in the sheet
Last edited by mossman; 12-20-2009 at 10:37 AM.
Somelike this would do it. Not sure about where the data may reside initially. That would help determine where to position the rows and columns.
![]()
Dim X as Integer Dim EndRow As Integer Dim SColumn As Integer Dim FirstRow As Integer Dim NewAnswer As String FirstRow = 7 EndRow = 17 SColumn = 6 For X = FirstRow To EndRow NewAnswer = NewAnswer & Cells(X, SColumn).Value & " ," Next X NewAnswer = Trim(Left(NewAnswer, Len(NewAnswer) - 1)) Cells(7, 7).Value = NewAnswer
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks