try this one

Sub aaaaaaaa()

Dim i, j, k, z As Long
k = Sheets(1).Range("a65356").End(xlUp).Row
   For i = k To 2 Step -1
             If Sheets(1).Cells(i, 1).Text <> Sheets(1).Cells(i - 1, 1).Text
Then
   Range("a" & i).Select
   Selection.EntireRow.Insert
    End If
  Next i

Cells(1, 1).Select

End Sub


On Wed, Feb 23, 2011 at 7:38 AM, Jacob <app...@gmail.com> wrote:

>   I have a range where I want to insert a row when the data changes.
>> Example Column B
>>
>> xyz
>> xyz
>> xyz
>> yyz
>> yyz
>> yyz
>> yyz
>> yyz
>> yyz
>> zyx
>> zyx
>> zyx
>> zyx
>> zyx
>> zyx
>>
>> I want to insert a row between xyz and yyz.  Also between yyz and
>> zyx.   I need am trying to find / write it using VBA.  Any help would
>> be greatley appreciated.
>>
>> Thanks,
>>
>> Jacob
>>
>> --
>>
>> ----------------------------------------------------------------------------------
>> 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
>>
>
>
>
> --
> *Regards*
> * *
> *Ashish Koul*
> *akoul*.*blogspot*.com <http://akoul.blogspot.com/>
> *akoul*.wordpress.com <http://akoul.wordpress.com/>
> My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830>
>
>
> P Before printing, think about the environment.
>
>
>


-- 
*Regards*
* *
*Ashish Koul*
*akoul*.*blogspot*.com <http://akoul.blogspot.com/>
*akoul*.wordpress.com <http://akoul.wordpress.com/>
My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830>


P Before printing, think about the environment.

-- 
----------------------------------------------------------------------------------
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

Reply via email to