Create Empty Cell after Cell Containing @

hl2qs

New Member
Joined
Aug 5, 2011
Messages
7
Hello,

I have a bunch of contacts I imported into Excel. Most of contacts are separated by an empty space, but some contacts are stuck together. Like this:

Bob
119 Cresap
Scottsville, VA
bob@virginia.edu
Jane
126 Stadium
Staunton, Va
Jane87@yahoo.com


Since the last cell of each contact contains their email address, is it possible to insert a blank cell after each cell containing @?

Thanks
Hamilton
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi Hamilton,

Try this on a backup copy of your work:

Code:
Public Sub Test()

Dim oFound As Range
Dim sAddress As String

Set oFound = ActiveSheet.UsedRange.Find("@", MatchCase:=False, lookat:=xlPart)
If Not oFound Is Nothing Then
    sAddress = oFound.Address
    Do

        If oFound.Offset(1, 0).Value <> "" Then
            oFound.Offset(1, 0).Insert shift:=xlDown
        End If
        
        Set oFound = ActiveSheet.UsedRange.FindNext(oFound)
        
    Loop While Not oFound Is Nothing And oFound.Address <> sAddress
End If

End Sub

Gary
 
Upvote 0
Worked beautifully. It didn't even create extra spaces were they already existed.

Thanks
Hamilton
 
Upvote 0

Forum statistics

Threads
1,215,465
Messages
6,124,977
Members
449,200
Latest member
Jamil ahmed

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