Microsoft Excel Macro for seperate rows to four different columns [closed]

I have an excel sheet that contains names (1st row), job titles (2nd row), company/institution (3rd row), and addresses(4th row) in one big column.

I am trying to separate them into four different columns.

Please help.


Looks like what you want is Copy >> Special Paste >> Transpose. You seem to want to switch rows to columns.

From Mcrosoft:

If data is entered in columns or rows, but you want to rearrange that data into rows or columns instead, you can quickly transpose the data from one to the other.

For example, the regional sales data that is organized in columns appears in rows after transposing the data, as shown in the following graphics.

Regional data in columns

Regional data in rows

1 - On the worksheet, do the following:

  • To rearrange data from columns to rows, select the cells in the columns that contain the data.
  • To rearrange data from rows to columns, select the cells in the rows that contain the data.

2 - On the Home tab, in the Clipboard group, click Copy.

Excel Ribbon Image

Keyboard shortcut To copy the selected data, you can also press CTRL+C.

Note You can only use the Copy command to rearrange the data. To complete this procedure successfully, do not use the Cut command.

3 - On the worksheet, select the first cell of the destination rows or columns into which you want to rearrange the copied data.

Note Copy areas and paste areas cannot overlap. Make sure that you select a cell in a paste area that falls outside of the area from which you copied the data.

4 - On the Home tab, in the Clipboard group, click the arrow below Paste, and then click Transpose. 5 - After the data is transposed successfully, you can delete the data in the copy area.


When I read your question, I understood it to mean that you have

                                                         

and you want

                                enter image description here

Assuming your data are in Column A, starting in cell A1, set up

  • B1=FIND(CHAR(10), $A1)
  • C1=FIND(CHAR(10), $A1, B1+1)
  • D1=FIND(CHAR(10), $A1, C1+1)
  • E1=LEFT($A1, B1-1)
  • F1=MID($A1, B1+1, C1-B1-1)
  • G1=MID($A1, C1+1, D1-C1-1)
  • H1=RIGHT($A1, LEN($A1)-D1)

Then, for the example data I provided for A1, you will get the following results:

  • B113
  • C123
  • D132
  • E1Harold Smith
  • F1President
  • G1ABC Corp
  • H1123 Main St

CHAR(10) gives an ASCII line separator character.  Columns B, C, and D are helper columns that find the offsets (locations) of the newlines in the data in Column A; then Columns E through H break the data into pieces around those locations.  Then, since you want to make a permanent change, do a copy and paste values.