+ Reply to Thread
Results 1 to 4 of 4

Can't Insert Column Due to Non Blank Cells

  1. #1
    Forum Contributor
    Join Date
    01-04-2013
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2013
    Posts
    142

    Can't Insert Column Due to Non Blank Cells

    I'm trying to run the below script, but on one of the worksheets I get a run time error 1004 when it gets to the point of inserting a column. It states I can't insert the column because non blank cells can't be shifted off the worksheet. A Ctrl+End on that worksheet takes me to cell XFD534. After researching a bit I've attempted in my code to change my used range by deleting all the columns to the right of my actual usable data, but this valiant attempt appears to be misguided and isn't working. Is there a way of resetting my used range in the code?

    For bonus points: I'm self taught in VBA and am still learning, so if there is anything else in the code that could be improved I'd appreciate the feedback.

    Thanks

    Please Login or Register  to view this content.

  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: Can't Insert Column Due to Non Blank Cells

    Maybe:

    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
    Forum Contributor
    Join Date
    01-04-2013
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2013
    Posts
    142

    Re: Can't Insert Column Due to Non Blank Cells

    Thanks for the response xladept. I appreciate your help. Your suggestion worked. But, while messing around with the code last night I figured out another fix that I think suites me better. I noticed the code I had to reset the used range was only firing on the sheet that was active at the time the code ran. I made a small adjustment to the code and it seems to be doing what I want:

    Please Login or Register  to view this content.

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

    Re: Can't Insert Column Due to Non Blank Cells

    You're welcome and thanks for the rep!

    (I think my way is better)

+ 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. [SOLVED] Macro to fill blank cells in column A based on non-blank cells
    By ktalamantez in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-28-2014, 02:47 PM
  2. [SOLVED] Auto insert blank row. (blank copy of row that includes merged cells)
    By rutts in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-22-2013, 07:48 PM
  3. Replies: 13
    Last Post: 09-19-2013, 06:54 PM
  4. [SOLVED] Compare 4 column values then insert a 5th columns value to a blank column/cell value
    By JasonKMcCoy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-27-2012, 06:01 PM
  5. Replies: 2
    Last Post: 10-04-2012, 03:19 PM
  6. [SOLVED] insert cell and shift cells right at every blank cell in column
    By zmarsh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-29-2012, 04:13 PM
  7. Macro insert cells in first blank column
    By chbrandt in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-16-2008, 01:07 AM
  8. insert a blank column if a cell is blank...how?
    By bego in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2007, 03:04 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