Jan 07 2022 09:25 AM
I am using Excel out of Office 360.
I need to sort a table with dates and account numbers. I need to sort by the account numbers, then add a blank line between the different group of account numbers using a macro.
Is that possible?
Sample data below.
Date | Account # |
12/8/2021 | 5500030 |
12/9/2021 | 8400084 |
12/10/2021 | 8400084 |
12/15/2021 | 5500061 |
12/16/2021 | 5800840 |
12/17/2021 | 5500061 |
12/17/2021 | 8400084 |
12/21/2021 | 5500061 |
12/22/2021 | 5500067 |
12/23/2021 | 5500061 |
12/23/2021 | 5500067 |
12/23/2021 | 8400084 |
12/23/2021 | 5500084 |
12/24/2021 | 5500061 |
12/27/2021 | 5500083 |
12/27/2021 | 5500067 |
12/28/2021 | 5500083 |
12/30/2021 | 5500083 |
12/31/2021 | 5500083 |
1/3/2022 | 5800815 |
1/3/2022 | 8400067 |
1/3/2022 | 5800815 |
1/3/2022 | 5800815 |
1/3/2022 | 5800815 |
1/3/2022 | 5800815 |
1/3/2022 | 5800815 |
1/3/2022 | 5800815 |
1/5/2022 | 5500061 |
1/6/2022 | 5500061 |
Jan 07 2022 10:30 AM
If you click the button in cell E1 in the attached file, is this what you want to do?
Jan 07 2022 11:33 AM
When I clicked on the button, it sorted the table and added lines between the different numbers, then also copied the information into several cells to the right.
Jan 07 2022 11:40 AM
Jan 07 2022 11:45 AM
Jan 07 2022 12:56 PM
Key:=Range("B2:B46" _
.SetRange Range("A1:B46")
For i = 2 To 100
Edit the ranges and the upper value in the for statement of the macro according to your requirements.
I tried the attached example with 2000 rows and it works as intended in my spreadsheet after i edited the ranges and the upper value of the macro.
Jan 07 2022 02:48 PM - edited Jan 07 2022 03:00 PM
How can I submit my file for a better example?
I have done the sort and added your text below "End With"
Do I need to edit any of that?
Jan 07 2022 02:56 PM
Click Reply
Then click
Open full text editor
Then click
browse
to select the file you want to attach.
Jan 07 2022 03:13 PM - edited Jan 07 2022 04:07 PM
I don't have an option to browse for a file.
I have 9 columns of data and variable rows. I can do the sort, but I just need to insert blank rows between the groups.
Jan 07 2022 04:57 PM
Jan 08 2022 04:22 AM
Maybe like in the attached file if you click the button in cell K1. The data is already sorted by column I and the macro executes the insertion of blank rows according to the groups in column I.
Jan 08 2022 06:11 AM
Jan 08 2022 10:35 AM
SolutionMaybe like in the attached file if you click the button in cell K1. The data is already sorted by column E and the macro executes the insertion of blank rows according to the groups in column E.
Jan 08 2022 12:14 PM
I created a macro to sort the data.
It ended with the following.
End With
End Sub
If I paste the macro from your file, what should I do to make it work?
Jan 10 2022 04:44 AM
Jan 08 2022 10:35 AM
SolutionMaybe like in the attached file if you click the button in cell K1. The data is already sorted by column E and the macro executes the insertion of blank rows according to the groups in column E.