Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Problems deleting columns

I am trying to add some columns with the following code:

For i = start To finish
Columns("G:G").Select
Selection.Insert Shift:=xlToRight
Next i

The problem I am having is that I often get the message:

"Run-time error '1004':
To prevent possible loss of data, Microsoftw Excel cannot shift
onblank cell off the worksheet. ...."

I have reset my last cell and saved, but the error returns. Any ideas?

David

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Problems deleting columns

David

You have data in the last column of your worksheet(IV) and are trying to
insert a column which would shift that data off the sheet and Excel does not
like it.

Clear the data from column IV and your macro will work but bear in mind evey
time you insert a column data is shifted right and the problem will return.

Mike

"David" wrote:

I am trying to add some columns with the following code:

For i = start To finish
Columns("G:G").Select
Selection.Insert Shift:=xlToRight
Next i

The problem I am having is that I often get the message:

"Run-time error '1004':
To prevent possible loss of data, Microsoftw Excel cannot shift
onblank cell off the worksheet. ...."

I have reset my last cell and saved, but the error returns. Any ideas?

David


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Problems deleting columns

See if this helps


http://support.microsoft.com/default.aspx?kbid=211769
"Cannot shift objects off sheet" error message when you hide columns in
Excel

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"David" wrote in message
oups.com...
I am trying to add some columns with the following code:

For i = start To finish
Columns("G:G").Select
Selection.Insert Shift:=xlToRight
Next i

The problem I am having is that I often get the message:

"Run-time error '1004':
To prevent possible loss of data, Microsoftw Excel cannot shift
onblank cell off the worksheet. ...."

I have reset my last cell and saved, but the error returns. Any ideas?

David



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Problems deleting columns

On Jul 2, 12:29 pm, "Bob Phillips" wrote:
See if this helps

http://support.microsoft.com/default.aspx?kbid=211769
"Cannot shift objects off sheet" error message when you hide columns in
Excel

--
HTH

Bob


I unhid every column and still get the message.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Problems deleting columns

Check for comments, merged cells, objects, too.

David wrote:

On Jul 2, 12:29 pm, "Bob Phillips" wrote:
See if this helps

http://support.microsoft.com/default.aspx?kbid=211769
"Cannot shift objects off sheet" error message when you hide columns in
Excel

--
HTH

Bob


I unhid every column and still get the message.


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Columns, Then deleting old columns May Excel Discussion (Misc queries) 4 October 30th 08 04:44 PM
Deleting cells from chart source data, causing problems Caeres Excel Discussion (Misc queries) 0 October 3rd 08 05:23 PM
Combining Text from 2 Columns into 1 then Deleting the 2 Columns sleepindogg Excel Worksheet Functions 5 September 19th 08 12:36 AM
Problems with Deleting rows using VBA Jeff Excel Programming 2 January 11th 05 02:31 AM
Problems deleting custom menu = double entries BenD Excel Programming 2 November 3rd 03 11:14 AM


All times are GMT +1. The time now is 10:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"