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
-
Installing Feature Update Windows 11 24H2
by
geekdom
7 hours ago -
Windows 11 Insider Preview build 27823 released to Canary
by
joep517
7 hours, 23 minutes ago -
Windows 11 Hotpatch
by
Hackmuss
2 hours, 15 minutes ago -
System Guard service error still won’t be fixed
by
Susan Bradley
8 hours, 2 minutes ago -
Operation ForumTroll: APT attack with Google Chrome zero-day exploit chain
by
Alex5723
2 hours, 13 minutes ago -
Troy Hunt of HaveIBeenPwned Phished
by
Lars220
2 hours, 11 minutes ago -
Microsoft Windows security auditing Code 5061
by
mpw
20 hours, 35 minutes ago -
Can’t display images in incoming Outlook 365 emails
by
WScopwriter
4 hours, 11 minutes ago -
Windows 11 Insider Preview Build 26200.5510 early builds of 25H2
by
Alex5723
5 hours, 39 minutes ago -
0Patch : Micropatches released for SCF File NTLM Hash Disclosure Vulnerability
by
Alex5723
5 hours, 8 minutes ago -
Select multiple emails and they all open up!
by
CeeJay
1 day, 21 hours ago -
How to remove an update preview
by
Gunny
32 minutes ago -
Third party add ins reminder
by
Susan Bradley
1 day, 1 hour ago -
OTF, which backs Tor, Let’s Encrypt and more, sues to save its funding
by
Nibbled To Death By Ducks
1 day, 15 hours ago -
Updating Windows 10 to Windows 11: 23H2 or 24H2?
by
Still Anonymous
2 days, 2 hours ago -
How can I update “Explorer Patcher”
by
WSplanckster
2 days, 4 hours ago -
Check out the home page for Signal
by
CAS
2 days, 1 hour ago -
Windows 11 and Trial version of MS Office
by
Tex265
2 days ago -
Windows 11 Insider Preview build 26120.3585 (24H2) released to BETA
by
joep517
2 days, 8 hours ago -
Windows 11 Insider Preview build 26200.5510 released to DEV
by
joep517
2 days, 8 hours ago -
Windows 11 Insider Preview Build 26100.3624 (24H2) released to Release Preview
by
joep517
2 days, 8 hours ago -
Limits on User Names
by
CWBillow
2 days, 5 hours ago -
MS-DEFCON 4: Mixed bag for March
by
Susan Bradley
5 hours, 14 minutes ago -
Non Apple Keyboards
by
pmcjr6142
6 hours, 30 minutes ago -
How to delete your 23andMe data – The Verge
by
AJNorth
2 days, 3 hours ago -
7 common myths about Windows 11 (Microsoft AD)
by
EyesOnWindows
2 days ago -
Error updating to Win11 0x8024a205
by
bmeacham
33 minutes ago -
default apps
by
chasfinn
1 day, 8 hours ago -
Will MS Works 4 work in MS Win 11?
by
MileHighFlyer
19 minutes ago -
Adding links to text in Word 2000
by
sgeneris
2 days, 7 hours ago
Recent blog posts
- 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
- Planning ahead for migration
- Woody Leonhard (1951–2025)
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.