I have a spreadsheet with 25 columns and 811 rows. The values in column "AA" are numeric and indicate a group ID of all possible duplicate records. I need to insert a blank row after each unique value in column "AA". Any suggestions?
Thanks.
I have a spreadsheet with 25 columns and 811 rows. The values in column "AA" are numeric and indicate a group ID of all possible duplicate records. I need to insert a blank row after each unique value in column "AA". Any suggestions?
Thanks.
attach please a small sample file with data and desired result
Sub Insert_Rows_after_groups() For i = Cells(Rows.Count, "AA").End(xlUp).Row To 2 Step -1 If Cells(i - 1, "AA") <> Cells(i, "AA") Then Cells(i, 1).EntireRow.Insert Next i End Sub
Last edited by mancubus; 09-19-2013 at 11:00 AM.
PLS DO NOT PM; OPEN A THREAD INSTEAD!!!
1) Posting Code
[CODE]PasteYourCodeHere[/CODE]
(or paste your code, select it, click # button)
2) Uploading File(s)
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.
3) Testing the Codes
always back up your files before testing the codes.
4) Marking the Thread as Solved
from Thread Tools (on the top right corner, above the first message)
Sample file attached. Test Tab= data that needs the blank rows inserted. Test result Tab = data with blank rows following groups of unique values in column AA.
missing "<>" in mancubus code
Sub Insert_Rows_after_groups() For i = Cells(Rows.Count, "AA").End(xlUp).Row To 2 Step -1 If Cells(i - 1, "AA") <> Cells(i, "AA") Then Cells(i, 1).EntireRow.Insert Next i End Sub
PLS DO NOT PM; OPEN A THREAD INSTEAD!!!
1) Posting Code
[CODE]PasteYourCodeHere[/CODE]
(or paste your code, select it, click # button)
2) Uploading File(s)
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.
3) Testing the Codes
always back up your files before testing the codes.
4) Marking the Thread as Solved
from Thread Tools (on the top right corner, above the first message)
Works beautifully! Thank you so very much.
you are welcome.would you mind marking the thread as solved from "thread tools"?
PLS DO NOT PM; OPEN A THREAD INSTEAD!!!
1) Posting Code
[CODE]PasteYourCodeHere[/CODE]
(or paste your code, select it, click # button)
2) Uploading File(s)
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.
3) Testing the Codes
always back up your files before testing the codes.
4) Marking the Thread as Solved
from Thread Tools (on the top right corner, above the first message)
Absolutely! Thanks again.