I'm using MS Excel 2010 and i have an excel sheet without macro's and without formula's everything is in raw format.
The sheet contains a lot of columns and rows (column A to WC) as shown in diagram below.
~ represents split view between columns
# represents row number
| A | B | C | ~ | AA | AB | ~ | WC |
-----------------------------------------
|# 1| x | x | x | ~ | x | x | ~ | x |
|# 10| x | x | x | ~ | x | x | ~ | x |
|# 100| x | x | x | ~ | x | x | ~ | x |
|#1000| x | x | x | ~ | x | x | ~ | x |
|#2000| x | x | x | ~ | x | x | ~ | x |
|#3000| x | x | x | ~ | x | x | ~ | x |
I would like to (merge) move all columns from "B" to "WC" into the last row of column "A".
Contents of column "A" may not be discarded. Every column "B" to "WC" has to be inserted below the last row in column "A"
Example (after):
| A | B | C | ~ | AA | AB | ~ | WC |
-----------------------------------------
|# 1| x | | | ~ | | | ~ | |
|# 10| x | | | ~ | | | ~ | |
|# 100| x | | | ~ | | | ~ | |
|#1000| x | | | ~ | | | ~ | |
|#2000| x | | | ~ | | | ~ | |
|#3000| x | | | ~ | | | ~ | |
|#4000| x | | | ~ | | | ~ | |
|#5000| x | | | ~ | | | ~ | |
|#6000| x | | | ~ | | | ~ | |
|#7000| x | | | ~ | | | ~ | |
|#8000| x | | | ~ | | | ~ | |
|#9999| x | | | ~ | | | ~ | |
My columns deliberately do not contain column headers (column-names).
What is the best way of achieving this?
I did found this thread: How to merge rows in a column into one cell in excel? -- and honestly i can't really understand how to apply in on my Sheet at this moment. Secondly that topic was created 3 years ago and was active more than 2 months ago. There for i decided to ask a new question here.
I have done research an found a lot of different types of ways of merging:
> Some recommend CONCATENATE-formula
> Some recommend Transpose formula
> Some recommend macro Some use a VBA script
> Some recommend JOIN function
> Some recommend payed solutions like Kutools
Considering the amount of columns in my situation i think that a VBA script solution would be most appropriate. If someone could please give feedback i would give a +1
Thanks!
Updates:
(its now late here) i'm scripting a new macro from scratch that basically does
1. select column B
2. select until top until last row in column B
3. copy contents
4. select column A
5. navigate to last row in column A
6. go 1 cell down
7. paste contents of column B
8. select column B
9. DELETE column B
10. Repeat 600 times :-)
Update 2:
Here is my self-made macro without for-loop:
Sub CopyColumnBtoAandDeleteB()
Worksheets("Sheet1").Activate
Range("B1", Range("B1").End(xlDown)).Select
Range("B1", Range("B1").End(xlDown)).Copy
Range("A1").End(xlDown).Select
Selection.Offset(1, 0).PasteSpecial xlPasteValues
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
End Sub
Oops. for some reason this stops after 305707 records, this was because my sheet contained many active cells, causing additional bank cells in a range and overflowing my rows in column A exceeding the memory limitations of Excel. That's a different issue for another time.
.Range(rCell, .Cells(lRows, rCell.Column).End(xlUp)).Cut _ wsNew.Cells(lRows, 1).End(xlUp)(2, 1)
– paul Mar 08 '15 at 21:28