+ Reply to Thread
Results 1 to 8 of 8

Insert shift:=xlDown inserts junks on the sheet

  1. #1
    Registered User
    Join Date
    12-05-2016
    Location
    Massachusetts
    MS-Off Ver
    Office 2013
    Posts
    13

    Insert shift:=xlDown inserts junks on the sheet

    Hi,
    I have a workbook thats been used by hundreds of customers, for years, which uses the following code:

    Rows("2:2").select
    selection.Insert shift:=xlDown

    On all the machines, office 2007, 2010, 2013, 2016 this code works fine, shifting the second row down, so I have a blank 2nd row now.

    But on one customers machine (Office 2016), the selection.insert line, inserts the previously selected range( which happens to be the second column) in all the columns ( to column XFD) and shifts everything else, on this sheet down... and that messes up everything!!!
    In this case I only have two columns on this sheet, to start with.

    is there a Property in Excel that I can change to fix this issue, without changing the code?? since it seems to be working fine for everyone else except this one customer, as a quick fix? since I am not doing another release till end of the year!!

    I hope my explanation makes sense..

    thank you,
    Karen16
    Last edited by Karen16; 07-06-2017 at 12:08 PM. Reason: typo

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Insert shift:=xlDown inserts junks on the sheet

    Hi Karen,

    The selection may be fouling it up - try:
    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    12-05-2016
    Location
    Massachusetts
    MS-Off Ver
    Office 2013
    Posts
    13

    Re: Insert shift:=xlDown inserts junks on the sheet

    Thanks XLAdept!
    i will change the syntax for the next release, but I wanted to know if there is anything I can do by setting any of the Excel properties to avoid that behavior..

    Karen16

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Insert shift:=xlDown inserts junks on the sheet

    It's not really anything to do with any Excel property.

    In the code you use Selection when inserting, and even though you've just selected row 2 that might not be exactly what you think it is.

    If you want to insert on a specific row/range/whatever then use an explicit reference to that row/range/whatever, eg Rows(2).
    If posting code please use code tags, see here.

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Insert shift:=xlDown inserts junks on the sheet

    Hi Karen,

    You're welcome and thanks for the rep!

    Norie answered your question the way I would have liked to

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  6. #6
    Registered User
    Join Date
    12-05-2016
    Location
    Massachusetts
    MS-Off Ver
    Office 2013
    Posts
    13

    Re: Insert shift:=xlDown inserts junks on the sheet

    Its not the answer I was looking for
    Why does Excel have to act differently on different machines!! This works on so many machines with no issues and has problem on this one machine

    but I will close the Thread, and thank you both for the answers!
    Karen16

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Insert shift:=xlDown inserts junks on the sheet

    They probably "fixed it" thinking it was broke

  8. #8
    Registered User
    Join Date
    12-05-2016
    Location
    Massachusetts
    MS-Off Ver
    Office 2013
    Posts
    13

    Re: Insert shift:=xlDown inserts junks on the sheet

    Just a quick note: I did try the Rows(2).insert and it did the same thing as my code. Excel doesn't want to let go of the previous selected "range". so, I used Application.CutCopyMode = False before the insert statements, and then both methods work.

    thank you

+ 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. “Selection.Insert Shift:=xlDown” gets Run-time error '1004'
    By watsonea4 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-02-2023, 07:07 AM
  2. [SOLVED] Insert Pivot Table only inserts a blank sheet
    By Dave H in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 09-21-2015, 01:58 PM
  3. VBA Help - Insert a row in Sheet 1 and it automatically inserts in Sheet 2
    By dholiman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2015, 01:39 PM
  4. Development of a macros that inserts a row into sheet 1 to insert in sheet 2
    By jj123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-18-2013, 05:24 AM
  5. Excel hangs while doing [Selection.Insert Shift:=xlDown]
    By dhorellou in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-23-2012, 05:13 AM
  6. [SOLVED] Selection.Insert Shift:=xlDown NOT WORKING!?!?!?!?
    By VBA FTW in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-07-2012, 04:43 PM
  7. Filter/Delete.Rows then Copy New Data and Insert xldown
    By exc4libur in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-14-2011, 06:36 PM

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