+ Reply to Thread
Results 1 to 4 of 4

Program to insert rows

  1. #1
    Forum Contributor
    Join Date
    08-16-2010
    Location
    Holland, MI
    MS-Off Ver
    Excel 2007
    Posts
    110

    Program to insert rows

    Hey All,
    I'm using the following code to insert rows into a spreadsheet...
    Please Login or Register  to view this content.
    rownumber and rowtotal are entered into a userform by the user. This works fine when regular rows are present. But, It goes crazy when I'm entering a row in the middle of a section where one of the cells in the row is merged.

    I got the code by recording a macro where I inserted a single row at the same location that I'm testing (where the merged cell is present). Can someone help me understand what I'm doing wrong or if there is alternative code that I can use to get this done?

    Thanks.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Program to insert rows

    No need to loop - this worked with merged cells for me.

    Replace your loop:

    Please Login or Register  to view this content.
    with

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    08-16-2010
    Location
    Holland, MI
    MS-Off Ver
    Excel 2007
    Posts
    110

    Re: Program to insert rows

    Perfect. Thanks. It didn't even cross my mind that the loop could be the problem. Thanks!!!

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Program to insert rows

    sorry, I should have been clearer: The loop was not the issue - the issue was with CopyOrigin:=xlFormatFromLeftOrAbove - it cannot merge cells - but you can copy and paste merged cells.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 10-28-2017, 10:51 AM
  2. Replies: 7
    Last Post: 10-14-2016, 05:33 PM
  3. Replies: 2
    Last Post: 09-11-2016, 12:40 PM
  4. Replies: 1
    Last Post: 09-11-2016, 12:39 PM
  5. Photo insert program for excel 2003?
    By richard11153 in forum Excel General
    Replies: 1
    Last Post: 11-18-2010, 02:54 PM
  6. Insert datas from another program
    By Tercjusz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2009, 02:24 PM
  7. how do i program excel to insert a new column monthly
    By jo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-06-2006, 05:25 AM

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