How to combine column data into one row

  • Thread starter Thread starter Haroon
  • Start date Start date
H

Haroon

Hi

I have data in 100 cells, A1:A100
I want to find out how can i combine them in one row seperated by a comma,
e.g. test1, test2, test3, etc in a row
at the moment they are in a column e.g.
test1
test2
test3
etc....


thanks in advance.
 
Why do you want commas? Do you want the cells in one column or 100 columns?
Comma seperated data (CSV) is usually a text file and not a xls file. I
think you may be a little confused.
 
The request sounded perfectly clear to me.

Dim Cell As Range

For Each Cell In Range("A2:A100")
Range("A1") = Range("A1") & "," & Cell
Next Cell
 
thanks charlie

when i add the code it dont do anything
where and how to i excute the code?

cheers
 
Put the code in a standard module, such as Module1. Put it in a subroutine
such as:

Sub Test()

' Put the code here

End Sub

As always: save a copy of your workbook first! Then put the cursor anywhere
inside Sub Test and press F5 to run it.
 
Thanks a lot Charlie, your a star * :)

Charlie said:
Put the code in a standard module, such as Module1. Put it in a subroutine
such as:

Sub Test()

' Put the code here

End Sub

As always: save a copy of your workbook first! Then put the cursor anywhere
inside Sub Test and press F5 to run it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top