+ Reply to Thread
Results 1 to 7 of 7

Insert X number of Copied row based on user input

  1. #1
    Registered User
    Join Date
    09-19-2014
    Location
    Philadelphia,PA
    MS-Off Ver
    2010
    Posts
    54

    Insert X number of Copied row based on user input

    Hi all,

    I have a code that prompts the user to state how many rows they need to insert, triggered if the place a "P" in column A.
    The code I have works sometimes and not others (pasted below). I think it has something to do if the User inserts a P above where the VBA has already run. Example: if user inputs a P in row 10, runs the VBA, and then tries to input the code in row 3.

    The error I get is:

    Run-time error '-2147417848 (80010108)':
    Method 'Insert' of object 'Range' failed

    The code copies the row that the user inputs the P in and copies it down to the number of rows the user inputs. It shifts everything else down so it doesn't copy over existing information.
    This macro is posted to the master sheet in the workbook and I am using excel 2010 if that matters.

    Any help, or any ideas would be greatly appreciated
    Thank you so much.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try this !


    Please Login or Register  to view this content.
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 10-27-2014 at 10:34 AM. Reason: optimization …

  3. #3
    Registered User
    Join Date
    09-19-2014
    Location
    Philadelphia,PA
    MS-Off Ver
    2010
    Posts
    54

    Re: Hi ! Try this !

    Marc L,

    Thank you for responding! I am still running into the same problem (same error). It works the first time I change a cell to P but doesn't work the next time.

    The line
    Please Login or Register  to view this content.
    becomes highlighted

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Insert X number of Copied row based on user input


    No issue on my side with differents Excel versions on several PC with different Windows versions …

    Maybe the worksheet is protected or full, code to paste to the same worksheet module :

    Please Login or Register  to view this content.
    Last edited by Marc L; 10-27-2014 at 10:59 AM. Reason: optimizing …

  5. #5
    Registered User
    Join Date
    09-19-2014
    Location
    Philadelphia,PA
    MS-Off Ver
    2010
    Posts
    54

    Re: Insert X number of Copied row based on user input

    I posted that in the worksheet and ran it, nothing happened. I have other code throughout the workbook if that changes anything

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Insert X number of Copied row based on user input


    No issue on my side …

    Reboot your PC, only open Excel and nothing else then start to try in a new workbook …

  7. #7
    Registered User
    Join Date
    09-19-2014
    Location
    Philadelphia,PA
    MS-Off Ver
    2010
    Posts
    54

    Re: Insert X number of Copied row based on user input

    And it is not protected

+ 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. Insert # of Rows based on User Input
    By afpilotb1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-23-2014, 11:40 AM
  2. Macro to insert one row into defined tabs based on user input
    By lexxasp1210 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-12-2013, 01:45 PM
  3. Data Input Form with number of line items based on user input
    By j_gideon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2013, 02:54 PM
  4. Using text box input to lookup number and replace based on user input into new column
    By harl3y412 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-28-2011, 03:15 PM
  5. Insert rows based on user input from cell value in other sheet
    By MrPisky in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-31-2011, 09:08 PM

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