I have a worksheet with many columns. I want to take the content of all
the columns and put it in just one column , lets say A. How can i go
about doing this?
I have a worksheet with many columns. I want to take the content of all
the columns and put it in just one column , lets say A. How can i go
about doing this?
I'm fairly new at this and it's a steep learning curve - there are no
doubt more elegent ways to do this.. but if you have a limited number
of columns that you need to work with and you know the columns in
advance, this will do the trick...
=======================================================
Sub merge()
Dim somestring As String
Dim somestring2 As String
Dim somestring3 As String
Dim mergedstring As String
somestring = Range("b1").Value
somestring2 = Range("c1").Value
somestring3 = Range("d1").Value
mergedstring = somestring & " " & somestring2 & " " & somestring3
Range("a1").Value = mergedstring
End Sub
=======================================================
HTH
Gary
In Cell A2 put the formula:
=B2 & C2 & D2 & E2 ..... etc.
and all the data will be concatenated. If you want some delimiter you can use this formula:
=B2 & "," & C2 & "," & D2 & "," & E2 ..... etc.
Then copy that formula down for the number of rows you have. If you want it then to be values copy Column A and Paste Special Values in Column A.
Originally Posted by Shan
---------------------------------------------------
ONLY APPLIES TO VBA RESPONSES WHERE APPROPRIATE
To insert code into the VBE (Visual Basic Editor)
- Copy the code.
- Open workbook to paste code into.
- Right click any worksheet tab, select View Code
- VBE (Visual Basic Editor) opens to that sheets object
- You may change to another sheets object or the This Workbook object by double clicking it in the Project window
- In the blank space below the word "General" paste the copied code.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks