I have a very long spreadsheet that I use as an inventory listing. Each item in the list has a bin number. I have sorted the list in bin number order to group items in the same bin together. After each group of items in a bin I want to add 3 blank rows to separate the listing to make it easier to read. How can I do this automatically without having to go thru the entire listing and insert them between bins?
![]() |
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 |
-
Adding Rows (Excel 2003)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Adding Rows (Excel 2003)
- This topic has 12 replies, 8 voices, and was last updated 18 years, 7 months ago.
AuthorTopicWScowboyfan
AskWoody LoungerDecember 1, 2005 at 2:51 am #426922Viewing 2 reply threadsAuthorReplies-
H. Legare Coleman
AskWoody PlusDecember 1, 2005 at 3:30 am #987862If the bin numbers are in column A and there are no header rows, then the code below should do what you ask.
Public Sub InsertBlankLines()
Dim I As Long, lLastRow As Long
lLastRow = Range("A65536").End(xlUp).Row - 1
For I = lLastRow - 1 To 1 Step -1
If Range("A1").Offset(I, 0).Value Range("A1").Offset(I + 1, 0).Value Then
Range(Range("A1").Offset(I + 1, 0), Range("A1").Offset(I + 3, 0)).EntireRow.Insert
End If
Next I
End Sub
-
WScowboyfan
AskWoody Lounger -
WSHansV
AskWoody LoungerDecember 2, 2005 at 7:49 am #988133You have placed the macro in the ThisWorkbook module. Instead, you should create a new standard module (Insert | Module in the Visual Basic Editor) and place the macro there.
The macro assumes that the bin numbers are in column A, if it is another column, you should adapt the code accordingly.
-
-
WSaluislugo
AskWoody Lounger -
WSsdckapr
AskWoody Lounger -
WSaluislugo
AskWoody LoungerOctober 2, 2006 at 5:34 pm #1031351Yes that did NOT work.
I think this might be it but it was a guess since I don’t really know VBA
Public Sub InsertBlankLines()
Dim I As Long, lLastRow As Long
lLastRow = Range(“A65536”).End(xlUp).Row – 1
For I = lLastRow – 1 To 1 Step -1
Range(Range(“A1”).Offset(I + 1, 0), Range(“A1”).Offset(I + 1, 0)).EntireRow.Insert
Next I
End Sub -
WSsdckapr
AskWoody Lounger
-
-
-
WSmbarron
AskWoody LoungerOctober 3, 2006 at 6:59 pm #1031544See the post starting here post 548,481 for both a macro and non-macro methods.
-
WSmbarron
AskWoody LoungerOctober 3, 2006 at 7:24 pm #1031549The following will insert one row based on a selection of cells; My previous post demonstarted the insertion of rows based on entire continous table of data.
Option Explicit Sub InsertBlankWithinSelection() Dim i As Long, eRow As Long, sRow As Long, sColumn As Long sColumn = Selection.Column sRow = Selection.Row eRow = Selection.Rows.Count For i = sRow + eRow To sRow Step -1 Cells(i, 1).EntireRow.Select Selection.Insert Shift:=xlDown Next Cells(sRow, sColumn).Select End Sub
-
WSaluislugo
AskWoody Lounger
-
-
-
-
WSGoCush
AskWoody LoungerDecember 1, 2005 at 6:07 am #987871To add to what Legare has given you, you might want to consider using his code on a COPY of your data.
I have found it prudent to keep my databases intact for future massaging.
When I take actions like inserting blank rows, I like to extract all records to another
sheet and take such actions on the Extracted records.
Just my two cents worth. -
WSWaggers
AskWoody LoungerDecember 2, 2005 at 9:20 am #988142(Edited by Waggers on 02-Dec-05 10:20. Edited to add link to MS article on subtotals)
Another option is to use subtotals on each change in bin number. You could select something harmless to total, like count of bin numbers. There are several advantages to this:
- You don’t have to write any VBA code
- Excel adds handy “levels” so that you can view a summary of your data or the raw data quickly
- You can easily remove the subtotals, restoring your spreadsheet to its current state (without having to make a backup copy)[/list]Just a thought.
(More info on subtotals: Microsoft Office Assistance: About subtotals)
Viewing 2 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
-
Where’s the cache today?
by
Up2you2
2 hours, 58 minutes ago -
Ascension says recent data breach affects over 430,000 patients
by
Nibbled To Death By Ducks
6 hours ago -
Nintendo Switch 2 has a remote killing switch
by
Alex5723
6 hours, 21 minutes ago -
Blocking Search (on task bar) from going to web
by
HenryW
11 hours, 1 minute ago -
Windows 10: Microsoft 365 Apps will be supported up to Oct. 10 2028
by
Alex5723
16 hours, 8 minutes ago -
Add or Remove “Ask Copilot” Context Menu in Windows 11 and 10
by
Alex5723
16 hours, 15 minutes ago -
regarding april update and may update
by
heybengbeng
17 hours, 44 minutes ago -
MS Passkey
by
pmruzicka
1 hour, 4 minutes ago -
Can’t make Opera my default browser
by
bmeacham
1 day, 1 hour ago -
*Some settings are managed by your organization
by
rlowe44
12 hours, 8 minutes ago -
Formatting of “Forward”ed e-mails
by
Scott Mills
1 day ago -
SmartSwitch PC Updates will only be supported through the MS Store Going Forward
by
PL1
1 day, 20 hours ago -
CISA warns of hackers targeting critical oil infrastructure
by
Nibbled To Death By Ducks
2 days, 5 hours ago -
AI slop
by
Susan Bradley
19 hours, 6 minutes ago -
Chrome : Using AI with Enhanced Protection mode
by
Alex5723
2 days, 6 hours ago -
Two blank icons
by
CR2
18 hours, 2 minutes ago -
Documents, Pictures, Desktop on OneDrive in Windows 11
by
ThePhoenix
2 days, 15 hours ago -
End of 10
by
Alex5723
2 days, 17 hours ago -
Single account cannot access printer’s automatic duplex functionality
by
Bruce
1 day, 15 hours ago -
test post
by
gtd12345
2 days, 23 hours ago -
Privacy and the Real ID
by
Susan Bradley
2 days, 14 hours ago -
MS-DEFCON 2: Deferring that upgrade
by
Susan Bradley
16 hours, 21 minutes ago -
Cant log on to oldergeeks.Com
by
WSJonharnew
3 days, 4 hours ago -
Upgrading from Win 10
by
WSjcgc50
1 day, 15 hours ago -
USB webcam / microphone missing after KB5050009 update
by
WSlloydkuhnle
1 day, 19 hours ago -
TeleMessage, a modified Signal clone used by US government has been hacked
by
Alex5723
3 days, 19 hours ago -
The story of Windows Longhorn
by
Cybertooth
3 days, 7 hours ago -
Red x next to folder on OneDrive iPadOS
by
dmt_3904
3 days, 21 hours ago -
Are manuals extinct?
by
Susan Bradley
22 hours, 13 minutes ago -
Canonical ditching Sudo for Rust Sudo -rs starting with Ubuntu
by
Alex5723
4 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.