PC Review


Reply
Thread Tools Rate Thread

Cutting cell with object

 
 
=?Utf-8?B?WmlwQ3Vycw==?=
Guest
Posts: n/a
 
      10th Apr 2007
I have a number of macros which run just fine on the computer that I
generated them on. This computer has Excel version 2002 SP3. The code fails
on a simple operation when I run the code on another machine with Excel
version 2000. The section of code is:

Range("E3").Select
Selection.Cut
Picture_Column = NumberOfCategories + 6
Sheets("All Concepts").Cells(3, Picture_Column).Select
ActiveSheet.Paste

Range("E3") contains a button and scroll bar that I want to move to another
location. Is the issue as simple as the difference in Excel versions or is
there something subtle I am missing.

Thanks in advance for your help.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      10th Apr 2007
Try it like this:



Picture_Column = NumberofCategories + 6
Range("E3").Cut Sheets("All Concepts") _
.Cells(3, Picture_Column)


If you still have problems, you may have a missing reference in your
workbook. After the error, go into the VBE with your project as the
activeproject (selected in the project window) and go to Tools=>References
(may have to hit reset first) and see if one of your references is marked as
MISSING. If so, you need to clear this up.

--
Regards,
Tom Ogilvy


"ZipCurs" wrote:

> I have a number of macros which run just fine on the computer that I
> generated them on. This computer has Excel version 2002 SP3. The code fails
> on a simple operation when I run the code on another machine with Excel
> version 2000. The section of code is:
>
> Range("E3").Select
> Selection.Cut
> Picture_Column = NumberOfCategories + 6
> Sheets("All Concepts").Cells(3, Picture_Column).Select
> ActiveSheet.Paste
>
> Range("E3") contains a button and scroll bar that I want to move to another
> location. Is the issue as simple as the difference in Excel versions or is
> there something subtle I am missing.
>
> Thanks in advance for your help.

 
Reply With Quote
 
=?Utf-8?B?WmlwQ3Vycw==?=
Guest
Posts: n/a
 
      10th Apr 2007
Tom,

Thanks for the quick response. The code you provided me works fine on the
Excel 2002 SP3, but not on 2000. Worth note is that the error dialog changes
from "Method 'Paste' of object '_Worksheet' failed" to "Method 'Cut" of
object 'Range' failed" with the new code.

I took a look at the Tools=>References and did not see anything of interest
to my untrained eye.

Two points worth noting:
- With the original and new code, when the code fails, Excel is frozen.
- With the original code, if I stop the code before ActiveSheet.Paste, and
manually paste the cut range, it works fine, although it does seem to create
a whole new set of formating problems, which I have not dug into.

Any further help would be greatly appreciated.

"Tom Ogilvy" wrote:

> Try it like this:
>
>
>
> Picture_Column = NumberofCategories + 6
> Range("E3").Cut Sheets("All Concepts") _
> .Cells(3, Picture_Column)
>
>
> If you still have problems, you may have a missing reference in your
> workbook. After the error, go into the VBE with your project as the
> activeproject (selected in the project window) and go to Tools=>References
> (may have to hit reset first) and see if one of your references is marked as
> MISSING. If so, you need to clear this up.
>
> --
> Regards,
> Tom Ogilvy
>
>
> "ZipCurs" wrote:
>
> > I have a number of macros which run just fine on the computer that I
> > generated them on. This computer has Excel version 2002 SP3. The code fails
> > on a simple operation when I run the code on another machine with Excel
> > version 2000. The section of code is:
> >
> > Range("E3").Select
> > Selection.Cut
> > Picture_Column = NumberOfCategories + 6
> > Sheets("All Concepts").Cells(3, Picture_Column).Select
> > ActiveSheet.Paste
> >
> > Range("E3") contains a button and scroll bar that I want to move to another
> > location. Is the issue as simple as the difference in Excel versions or is
> > there something subtle I am missing.
> >
> > Thanks in advance for your help.

 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      10th Apr 2007
I doubt there is much else I can offer.

the code is generic enough that it should work in any version of excel.
Create a new workbook in xl2000 and try it in that.

I suspect it is some environmental factor that is causing the problem -
freeze ups sometimes related to Sheet level events and possibly calculation.
The sheet protection scheme in xl2000 is much less sophisticated/much more
restrictive than that in xl2002 and later - so I assume you don't have the
sheets protected.

--
Regards,
Tom Ogilvy


"ZipCurs" wrote:

> Tom,
>
> Thanks for the quick response. The code you provided me works fine on the
> Excel 2002 SP3, but not on 2000. Worth note is that the error dialog changes
> from "Method 'Paste' of object '_Worksheet' failed" to "Method 'Cut" of
> object 'Range' failed" with the new code.
>
> I took a look at the Tools=>References and did not see anything of interest
> to my untrained eye.
>
> Two points worth noting:
> - With the original and new code, when the code fails, Excel is frozen.
> - With the original code, if I stop the code before ActiveSheet.Paste, and
> manually paste the cut range, it works fine, although it does seem to create
> a whole new set of formating problems, which I have not dug into.
>
> Any further help would be greatly appreciated.
>
> "Tom Ogilvy" wrote:
>
> > Try it like this:
> >
> >
> >
> > Picture_Column = NumberofCategories + 6
> > Range("E3").Cut Sheets("All Concepts") _
> > .Cells(3, Picture_Column)
> >
> >
> > If you still have problems, you may have a missing reference in your
> > workbook. After the error, go into the VBE with your project as the
> > activeproject (selected in the project window) and go to Tools=>References
> > (may have to hit reset first) and see if one of your references is marked as
> > MISSING. If so, you need to clear this up.
> >
> > --
> > Regards,
> > Tom Ogilvy
> >
> >
> > "ZipCurs" wrote:
> >
> > > I have a number of macros which run just fine on the computer that I
> > > generated them on. This computer has Excel version 2002 SP3. The code fails
> > > on a simple operation when I run the code on another machine with Excel
> > > version 2000. The section of code is:
> > >
> > > Range("E3").Select
> > > Selection.Cut
> > > Picture_Column = NumberOfCategories + 6
> > > Sheets("All Concepts").Cells(3, Picture_Column).Select
> > > ActiveSheet.Paste
> > >
> > > Range("E3") contains a button and scroll bar that I want to move to another
> > > location. Is the issue as simple as the difference in Excel versions or is
> > > there something subtle I am missing.
> > >
> > > Thanks in advance for your help.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
changing background of a clip art picture or cutting the object =?Utf-8?B?THVuYQ==?= Microsoft Powerpoint 1 19th Aug 2007 09:22 PM
Cutting/pasting from Excel.Application object - missing the obvious? David Evans Microsoft Excel Programming 1 19th Apr 2007 09:44 AM
Re: cutting characters from a cell RagDyer Microsoft Excel Worksheet Functions 0 6th Jan 2007 02:46 AM
How do I allow users to edit a cell's contents, but prevent them from moving, cutting or deleting the cell? Dan E Microsoft Excel Discussion 4 28th Mar 2005 09:34 PM
How do i allow users to edit a cell's contents, but prevent them from moving, cutting or deleting the cell? Dan E Microsoft Excel Programming 7 28th Mar 2005 12:44 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:14 AM.