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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
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,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

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