Forum Discussion
OliverScheurich
Oct 19, 2022Gold Contributor
Re: Splitting families into individuals excel formatting
3 Replies
- jasonsheeleyCopper ContributorThanks for the help, im still trying to get it to work. Well, i am trying to use the tool properly, im sure it works. It's my lack of excel skill! i keep getting errors but im pretty sure it's user error.
- OliverScheurichGold Contributor
Sub names() Dim i As Long Dim j As Long Dim k As Long Range("P:AB").Clear k = Range("A" & Rows.Count).End(xlUp).Row j = 2 For i = 2 To k Range(Cells(i, 1), Cells(i, 13)).Copy Destination:=Range(Cells(j, 16), Cells(j, 28)) Range(Cells(j, 18), Cells(j, 19)).Clear j = j + 1 Range(Cells(i, 1), Cells(i, 13)).Copy Destination:=Range(Cells(j, 16), Cells(j, 28)) Cells(j, 17).Value = Cells(j, 19).Value Range(Cells(j, 18), Cells(j, 19)).Clear j = j + 1 Next i End SubYou can try these lines of code. In the attached file in sheet "Tabelle2" you can click the button in cell O2 to run the macro.
After copying your data select cell A2 in sheet "Tabelle2" and paste the data. The data should be entered in columns A to M. There can be hundreds of rows (actually tens of thousands, however that would affect the runtime of the macro) in columns A to M.
- jasonsheeleyCopper ContributorThis is amazing!