insert blank row between list of numbers and names

gsf314

New Member
Joined
Apr 9, 2012
Messages
32
Column A contains numbers in chronological order followed by names in alphabetical order. I need VBA code to insert a blank row between the last number and the first name. Thanks.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
So is it enough to say the blank row should just be inserted when the number in Col A changes?
 
Upvote 0
Maybe this
Code:
Sub test()
Dim lr As Long, r As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
    For r = lr To 2 Step -1
        If Application.WorksheetFunction.IsText(Range("A" & r)) And Application.WorksheetFunction.IsNumber(Range("A" & r - 1)) Then
           Rows(r).EntireRow.Insert
        End If
     Next r
End Sub
 
Upvote 0
No. A single blank row must be inserted between the last number in the column and the first name. To explain: This is a data validation list containing mostly ID numbers, but some names of those who don't have ID numbers. I want the data entry people to enter a 5 or 6 digit number to populate the columns to the right. If there is no number available, they will use the drop down list (validation list) to click on the name. It's easier to enter the number than to scroll through a list of names. The blank row will open the validation list at that point, skipping over all the 200 or so numbers above it.
 
Upvote 0
Phooey! I wrote my reply before scrolling down. The code worked perfectly! Thanks so much! This was the last piece of an involved set of macros that I've written/recorded/taken from Mr. Excel and others. I'm a novice, but I'm learning. You people have been such a big help. Thanks again!!!
 
Upvote 0
Hey Robert, thanks....I was a bit like you though, taking a stab....:biggrin:
 
Upvote 0

Forum statistics

Threads
1,214,394
Messages
6,119,263
Members
448,881
Latest member
Faxgirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top