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?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
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
-
WU help needed with “Some settings are managed by your organization”
by
Peobody
6 hours, 33 minutes ago -
No Newsletters since 27 January
by
rog7
2 hours, 30 minutes ago -
Linux Mint Debian Edition 7 gets OEM support, death of Ubuntu-based Mint ?
by
Alex5723
11 hours, 3 minutes ago -
Windows Update “Areca Technology Corporation – System – 6.20.0.41”
by
Bruce
1 hour, 40 minutes ago -
Google One Storage Questions
by
LHiggins
13 hours, 23 minutes ago -
Button Missing for Automatic Apps Updates
by
pmcjr6142
8 hours, 39 minutes ago -
Ancient SSD thinks it’s new
by
WSila
5 hours, 38 minutes ago -
Washington State lab testing provider exposed health data of 1.6 million people
by
Nibbled To Death By Ducks
21 hours, 22 minutes ago -
WinRE KB5057589 fake out
by
Susan Bradley
14 hours, 41 minutes ago -
The April 2025 Windows RE update might show as unsuccessful in Windows Update
by
Susan Bradley
5 hours, 20 minutes ago -
Firefox 137
by
Charlie
1 hour, 39 minutes ago -
Whisky, a popular Wine frontend for Mac gamers, is no more
by
Alex5723
1 day, 9 hours ago -
Windows 11 Insider Preview build 26120.3863 (24H2) released to BETA
by
joep517
1 day, 9 hours ago -
Windows 11 Insider Preview build 26200.5551 released to DEV
by
joep517
1 day, 10 hours ago -
New Windows 11 PC setup — can I start over in the middle to set up a local id?
by
ctRanger
5 hours, 49 minutes ago -
Windows 11 Insider Preview Build 26100.3902 (24H2) released to Release Preview
by
joep517
1 day, 13 hours ago -
Oracle kinda-sorta tells customers it was pwned
by
Nibbled To Death By Ducks
1 day, 19 hours ago -
Global data centers (AI) are driving a big increase in electricity demand
by
Kathy Stevens
2 days, 5 hours ago -
Office apps read-only for family members
by
b
2 days, 8 hours ago -
Defunct domain for Microsoft account
by
CWBillow
2 days, 5 hours ago -
24H2??
by
CWBillow
5 hours, 42 minutes ago -
W11 23H2 April Updates threw ‘class not registered’
by
WindowsPersister
1 hour, 36 minutes ago -
Master patch listing for April 8th, 2025
by
Susan Bradley
5 hours, 32 minutes ago -
TotalAV safety warning popup
by
Theodore Nicholson
1 day, 4 hours ago -
two pages side by side land scape
by
marc
4 days, 6 hours ago -
Deleting obsolete OneNote notebooks
by
afillat
4 days, 8 hours ago -
Word/Outlook 2024 vs Dragon Professional 16
by
Kathy Stevens
3 days, 11 hours ago -
Security Essentials or Defender?
by
MalcolmP
3 days, 14 hours ago -
April 2025 updates out
by
Susan Bradley
1 hour, 37 minutes ago -
Framework to stop selling some PCs in the US due to new tariffs
by
Alex5723
3 days, 7 hours ago
Recent blog posts
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.