This Procedure Should be Like This :
Sub InsertRow() For x = 1 To Range("A65536").End(xlUp).Row * 2 If Range("A" & Trim(Str(x))).Value <> "" And Range("A" & Trim(Str(x))).Offset(1, 0).Value <> "" Then Application.StatusBar = "Inserting Rows on Row : " & Trim(Str(x + 1)) Range("A" & Trim(Str(x + 1))).EntireRow.Insert End If Next x End Sub This is inserting a Blank row after each Non-Blank Cell in Range("A:A") 2) . If TypeName(selection)<>"Range" then Exit sub Sub Exits() If TypeName(Selection) = "Range" Then MsgBox Selection.Address & " is selected , i am going Out of Procedure", vbInformation End If End Sub it means if any range is selected then program execution will not go to the next code after this statement. From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of vijayajith VA Sent: Saturday, August 13, 2011 6:47 PM To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ help required 4 Hi, Can anyone explain me below code ? 1 )for x = 1 To WkSht.Range("A65536").End(xlUp).Row If WkSht.Range("A" & Trim(Str(x))) <> "" Then Application.StatusBar = "Inserting Rows on Row : " & Trim(Str(x + 1)) WkSht.Range("A" & Trim(Str(x + 1))).EntireRow.Insert 2)If TypeName(Selection) <> "Range" Then Exit Sub Thanks in advance -- -- ---------------------------------------------------------------------------- ------ Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel