I have a mullti-column, multi-row, spreadsheet that starts off in Column “A” with the Social Security number. I would like to insert a blank row between the first social security number and the second social security number and between the second and third social security numbers and so on through all the social security numbers. Is there some function I missed that will do that?
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Insert balnk row on change in Social Security Numb (Excel XP)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Insert balnk row on change in Social Security Numb (Excel XP)
- This topic has 15 replies, 7 voices, and was last updated 15 years, 11 months ago.
AuthorTopicWSlawrence_groves
AskWoody LoungerSeptember 6, 2004 at 12:38 pm #409548Viewing 11 reply threadsAuthorReplies-
WSRudi
AskWoody Lounger -
WSRudi
AskWoody Lounger -
WSAlanMiller
AskWoody LoungerSeptember 6, 2004 at 1:04 pm #873651Do you want to do this manually? If so, you can right-click the row number (to the left of column A) then click “Insert” on the popup context menu. This will insert a blank row above the row you clicked on. If you want something automated, you’d need a VBA macro. Post back if you need the latter.
Alan
-
WSAlanMiller
AskWoody LoungerSeptember 6, 2004 at 1:04 pm #873652Do you want to do this manually? If so, you can right-click the row number (to the left of column A) then click “Insert” on the popup context menu. This will insert a blank row above the row you clicked on. If you want something automated, you’d need a VBA macro. Post back if you need the latter.
Alan
-
H. Legare Coleman
AskWoody PlusSeptember 6, 2004 at 3:15 pm #873701For a non macro way of doing this, see Hans’ Post.
-
H. Legare Coleman
AskWoody PlusSeptember 6, 2004 at 3:15 pm #873702For a non macro way of doing this, see Hans’ Post.
-
WSkjktoo
AskWoody Lounger -
WSkjktoo
AskWoody Lounger -
WSlawrence_groves
AskWoody Lounger -
WSlawrence_groves
AskWoody Lounger -
Jimmyc5559
AskWoody PlusMay 1, 2009 at 9:09 am #1158831I hate to post to such an old thread…but I need to accomplish the same thing and the links referenced in this post are broken–plus I believe a file attachment existed at one time too & its missing.
My column “A” is a numeric sequence [it starts at 1] and I need to insert 2 blank rows when the numeric value changes. The numeric values are already sequentially in order [1, 2, 3, 4. etc]. So for clarity, when the value changes column A for 1 to 2…I need to insert 2 blank rows after the last 1 value in column A. My data starts in row 1 [no header row] and extends to row 2165. THANKS.
-
WSmbarron
AskWoody LoungerMay 1, 2009 at 10:38 am #1158836The following macro will insert two blank rows on every change in data in the A column:
Code:Sub insert2() Dim i As Long, lRow As Long lRow = Cells(Rows.Count, 1).End(xlUp).Row For i = lRow To 2 Step -1 If Cells(i, 1) Cells(i - 1, 1) Then Range(Cells(i, 1), Cells(i + 1, 1)).EntireRow.Insert End If Next End Sub
-
Jimmyc5559
AskWoody PlusMay 1, 2009 at 11:50 am #1158847The following macro will insert two blank rows on every change in data in the A column:
Code:Sub insert2() Dim i As Long, lRow As Long lRow = Cells(Rows.Count, 1).End(xlUp).Row For i = lRow To 2 Step -1 If Cells(i, 1) Cells(i - 1, 1) Then Range(Cells(i, 1), Cells(i + 1, 1)).EntireRow.Insert End If Next End Sub
Mike,
Thanks for the code…works like a charm.I want to understand your logic..it appears that cell pointer goes to the very bottom of the worksheet and moves to the last row with actual data, correct?
You then work “backwards or move up the column” to calculate the comparison, yes?
Finally, what part of the code inserts the 2 rows? I see the row insert command but wouldn’t this only insert one row? I was able through trial and error to get a formula approach to work by using an extra column–but I could never figure out how to insert 2 rows versus 1.
Thanks for you patience.
JimC -
WSmbarron
AskWoody LoungerMay 1, 2009 at 1:09 pm #1158854Mike,
Thanks for the code…works like a charm.I want to understand your logic..it appears that cell pointer goes to the very bottom of the worksheet and moves to the last row with actual data, correct?
You then work “backwards or move up the column” to calculate the comparison, yes?
Yes the macro starts at the bottoms and works its way up. The reason for this is because of the rows being inserted. When you start at the bottom, the inserted rows are inserted under the row being investigated. Since these rows are under the current row, or the row represented by the variable “i”, they are not evaluated in the next loop. If you go start at the top row and then insert rows, you have to account for the inserted rows in the loop.
Finally, what part of the code inserts the 2 rows? I see the row insert command but wouldn’t this only insert one row? I was able through trial and error to get a formula approach to work by using an extra column–but I could never figure out how to insert 2 rows versus 1.
This line inserts the two rows.
Code:Range(Cells(i, 1), Cells(i + 1, 1)).EntireRow.Insert
It is the same as selecting the two rows and right clicking and choosing the insert command. For example, you’ve reached the first change in numbers (the change from 49 to 50 for example). You would highlight the topmost row with the number 50 and the row below and then right click and choose insert. This will shift the everything down two rows.
-
Jimmyc5559
AskWoody PlusMay 1, 2009 at 1:32 pm #1158858Yes the macro starts at the bottoms and works its way up. The reason for this is because of the rows being inserted. When you start at the bottom, the inserted rows are inserted under the row being investigated. Since these rows are under the current row, or the row represented by the variable “i”, they are not evaluated in the next loop. If you go start at the top row and then insert rows, you have to account for the inserted rows in the loop.
This line inserts the two rows.
Code:Range(Cells(i, 1), Cells(i + 1, 1)).EntireRow.Insert
It is the same as selecting the two rows and right clicking and choosing the insert command. For example, you’ve reached the first change in numbers (the change from 49 to 50 for example). You would highlight the topmost row with the number 50 and the row below and then right click and choose insert. This will shift the everything down two rows.
Mike,
Thanks for the explaination….appreciated. Now I understand why you started from the bottom. Most of the time I have a hard time with the VBA syntax and how to “loop” it, etc. This time my logic was flawed too….I guess I know why I couldn’t get it to work. JimC
-
-
-
Viewing 11 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Should A Person Laser Traditional Hair Removal Treatment As Yet? (Awaiting moderation)
by
franklynesl
3 minutes ago -
Obscure historical facts about Windows
by
Cybertooth
54 minutes ago -
Microsoft Backup
by
Linda2019
1 hour, 24 minutes ago -
What is the best notepad++ version for W7?
by
Picky
3 hours, 46 minutes ago -
What are right steps to move MS 365 Office+OneDrive files from PC to iMac?
by
glnz
10 hours, 47 minutes ago -
How to move existing MS 365 Office with OneDrive files from PC to new iMac
by
glnz
10 hours, 49 minutes ago -
How to move MS 365 files (some on OneDrive) from PC to iMac
by
glnz
1 day, 5 hours ago -
Microsoft adding Quick Machine Recovery to Windows 11
by
Alex5723
1 day, 6 hours ago -
Microsoft vs Passwords
by
Alex5723
14 hours, 4 minutes ago -
Windows 11 Insider Preview build 26200.5516 released to DEV
by
joep517
1 day, 9 hours ago -
Windows 11 Insider Preview build 26120.3653 (24H2) released to BETA
by
joep517
1 day, 9 hours ago -
Two March KB5053606 updates?
by
Adam
1 day, 3 hours ago -
MS Edge Not Updating to v134.0.3124.95 (rel. 27-Mar-2025)
by
lmacri
1 day, 3 hours ago -
Intel® Graphics/Sound Driver updates for 7th-10th Gen Intel® Core™ Processor
by
Alex5723
1 day, 6 hours ago -
Is there a comprehensve way to tranfer ALL current Edge Settings into a new Edge
by
Tex265
1 day, 5 hours ago -
Transferring ALL info/settings from current Firefox to new computer Firefox
by
Tex265
1 day, 4 hours ago -
DOGE Wants to Replace SSA 60 Million Line COBOL Codebase in Months
by
EyesOnWindows
2 hours, 4 minutes ago -
KB5051989 Usb printer Post Ipp
by
licencesti
1 day, 21 hours ago -
Removing bypassnro
by
Susan Bradley
5 hours, 42 minutes ago -
Up to 30 seconds to show “Recent Topics”
by
PL1
1 day, 2 hours ago -
Sound changes after upgrade from W11 23H2
by
WStaylorpsepa
3 hours, 15 minutes ago -
Windows bug blocks BIOS updates for Lenovo ThinkPad laptops
by
Alex5723
2 days, 7 hours ago -
O&O Software – ‘World Backup Day’ Sale
by
unbob
2 days, 3 hours ago -
Still version 23H2?
by
WSbxcfilm
2 days, 7 hours ago -
Ubuntu 25.04 (Plucky Puffin) Beta released
by
Alex5723
2 days, 13 hours ago -
How to install App Store apps on an external SSD
by
Alex5723
2 days, 14 hours ago -
Where is Windows going?
by
Susan Bradley
5 hours, 56 minutes ago -
Installing Feature Update Windows 11 24H2
by
geekdom
3 days, 8 hours ago -
Windows 11 Insider Preview build 27823 released to Canary
by
joep517
3 days, 8 hours ago -
Windows 11 Hotpatch
by
Hackmuss
2 days, 15 hours ago
Recent blog posts
- Removing bypassnro
- Where is Windows going?
- System Guard service error still won’t be fixed
- Third party add ins reminder
- MS-DEFCON 4: Mixed bag for March
- Classic and Extended Control Panel — no need to say goodbye
- Things you can do in 2025 that you couldn’t do in 2024
- Revisiting Windows 11’s File Explorer
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.