Inserting Blank Row if it contains certain text

Tabasco

New Member
Joined
Feb 21, 2011
Messages
2
Wanted to add a blank row after every email address. I was thinking if any part of a cell contains "@" add a blank under it... Wasn't sure how to set the macro for it

For example...

Name
Address
123@email.com
* BLANK HERE*


Thanks
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Try something like this...

B2: =COUNTIF(A1,"*@*")
Copy that formula down through as many rows as you have data

• Select the range containing that formula
• CTRL+F
...Find what: 1
...Click: Options (if necessary)...Look in: Values...Click: Find All
While that window is still open...
• CTRL+A...to select all matching cells...Click: Close
Now all cell containing 1 are selected (and they are 1 row below each email
• Home.Insert.Insert_sheet_rows

Is that something you can use?
 
Upvote 0
try >>> Change the range as req.
Code:
[/FONT]
[FONT=Courier New]Sub try()
Dim c As Range
For Each c In Range("A1:A10")
 If c.Value Like "*@*" Then
 c.Offset(1, 0).EntireRow.Insert
 End If
Next c
End Sub
 
Upvote 0
try >>> Change the range as req.
Code:
[FONT=Courier New]Sub try()
Dim c As Range
For Each c In Range("A1:A10")
 If c.Value Like "*@*" Then
 c.Offset(1, 0).EntireRow.Insert
 End If
Next c
End Sub[/FONT]


Hi,
Your above code helped me, so can you help me on below :
[TABLE="******* 191"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Step 1[/TD]
[TD]Login[/TD]
[/TR]
[TR]
[TD]Step 2[/TD]
[TD]Validate username[/TD]
[/TR]
[TR]
[TD]Step 3[/TD]
[TD]Logout [/TD]
[/TR]
[TR]
[TD]Step 4[/TD]
[TD]Login DB[/TD]
[/TR]
[TR]
[TD]B. Row
B. Row[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]B. Row[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]Step 5[/TD]
[TD]Validate username[/TD]
[/TR]
[TR]
[TD]Step 6[/TD]
[TD]Logout DB[/TD]
[/TR]
</tbody>[/TABLE]


Above i mentioned my case as example.
Query is : after adding a blank row after specific text how i can i correct the numbering(Sequence) of steps. Like previously i was having Total 6 Steps, so after adding blank rows it should show Total 9 Steps. and Blank row should replace with the name as Step "*".

Thanks.
 
Upvote 0
Hi Pedie,
I have entered this code in the macro, and it running when a test it.
But once I am in my excel sheet, the macro don't run automatically once I enter the name. I need always to go in VBA, and click on the "play" button to execute the macro.
Is there a way, once I enter the name, automatically a line is created without going to go myself to press 'run'?
thanks
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,834
Members
452,947
Latest member
Gerry_F

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