+ Reply to Thread
Results 1 to 6 of 6

Macro to Insert Row if Rows Don't Equal

  1. #1
    Registered User
    Join Date
    05-31-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2003
    Posts
    9

    Macro to Insert Row if Rows Don't Equal

    I am trying to create a macro that will automatically insert 2 rows in the two rows adjacent to each other do not equal. It works perfectly for about the first 1000 rows and then all of a sudden it stops working. I don't know if there is some other issue at work here but wanted to see if anyone had any ideas.


    Please Login or Register  to view this content.
    End Sub

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to Insert Row if Rows Don't Equal

    You have to also increment the "position" variable when you insert the rows. Maybe we can help you make your code better if you provide a sample sheet that you are using with the above code.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    05-31-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Macro to Insert Row if Rows Don't Equal

    I would but I am not able to provide that information as it is company info. Basically it is a column full of company locations. Hope that helos.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to Insert Row if Rows Don't Equal

    You do not need to upload your original file. Just a sample file with dummy data will do, so we understand the layout.

  5. #5
    Registered User
    Join Date
    05-31-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Macro to Insert Row if Rows Don't Equal

    Notice the issue when the script is ran between city 4 and city 5.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-31-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Macro to Insert Row if Rows Don't Equal

    I figured it out. Thanks for trying.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1