PC Review


Reply
Thread Tools Rate Thread

Copying Range gives object defined run wrror

 
 
gtslabs
Guest
Posts: n/a
 
      19th Apr 2007

I am trying to copy a range from one sheet to another using the
following statement.
I do not get a compile error but a Object Defined Run Error.

I am calling this from the current worksheet with a command button and
putting the data in a sheet called "Sample Log"

What am I doing wrong?

Worksheets("Sample Log").Range(Cells(samplerow, 6), Cells(samplerow,
42)).Value = Range(Cells(R, 6), Cells(R, 42)).Value

 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      19th Apr 2007
Hi gtslabs

Note that Cells point to the activesheet now and not to sheet Sample Log
> Worksheets("Sample Log").Range(Cells(samplerow


Add Worksheets("Sample Log"). in front of Cells (two times)

Worksheets("Sample Log").Cells(....................

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"gtslabs" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>
> I am trying to copy a range from one sheet to another using the
> following statement.
> I do not get a compile error but a Object Defined Run Error.
>
> I am calling this from the current worksheet with a command button and
> putting the data in a sheet called "Sample Log"
>
> What am I doing wrong?
>
> Worksheets("Sample Log").Range(Cells(samplerow, 6), Cells(samplerow,
> 42)).Value = Range(Cells(R, 6), Cells(R, 42)).Value
>

 
Reply With Quote
 
gtslabs
Guest
Posts: n/a
 
      19th Apr 2007
That helped somewhat but I still could not get it to work.

I have this working but it pastes the formats.
How can I use this and only paste the values?

Range(Me.Cells(R, 6), Me.Cells(R, 42)).Copy Worksheets("Sample
Log").Cells(samplerow, 9)


 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      19th Apr 2007
Try this

With Range(Me.Cells(R, 6), Me.Cells(R, 42))
Worksheets("Sample Log").Cells(samplerow, 9).Resize(.Rows.Count, _
.Columns.Count).Value = .Value
End With


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"gtslabs" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> That helped somewhat but I still could not get it to work.
>
> I have this working but it pastes the formats.
> How can I use this and only paste the values?
>
> Range(Me.Cells(R, 6), Me.Cells(R, 42)).Copy Worksheets("Sample
> Log").Cells(samplerow, 9)
>
>

 
Reply With Quote
 
gtslabs
Guest
Posts: n/a
 
      19th Apr 2007
Worked Great - Thanks


On Apr 19, 1:40 pm, "Ron de Bruin" <rondebr...@kabelfoon.nl> wrote:
> Try this
>
> With Range(Me.Cells(R, 6), Me.Cells(R, 42))
> Worksheets("Sample Log").Cells(samplerow, 9).Resize(.Rows.Count, _
> .Columns.Count).Value = .Value
> End With
>
> --
>
> Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm
>
>
>
> "gtslabs" <gtsl...@comcast.net> wrote in messagenews:(E-Mail Removed)...
> > That helped somewhat but I still could not get it to work.

>
> > I have this working but it pastes the formats.
> > How can I use this and only paste the values?

>
> > Range(Me.Cells(R, 6), Me.Cells(R, 42)).Copy Worksheets("Sample
> > Log").Cells(samplerow, 9)- Hide quoted text -

>
> - Show quoted text -



 
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
ASSIGNING THE VALUE TO A NAMED RANGE GIVING OBJECT DEFINED ERROR CAPTGNVR Microsoft Excel Programming 8 16th Feb 2007 05:13 PM
Application-defined or object-defined error (worksheet, range, sel =?Utf-8?B?ZGFyeG91bA==?= Microsoft Excel Programming 4 2nd Aug 2006 01:59 PM
Copying A Range of Cells From one Sheet to Another - Error Application Defined or Object Defined Matt Microsoft Excel Programming 3 25th Jul 2006 01:13 AM
Range - Application Defined or Object Defined Error Dyl Microsoft Excel Programming 6 31st Oct 2005 07:57 PM
Re: Application or Object Defined Error when trying to change a Range's text Wes Lee Microsoft Excel Programming 2 19th Sep 2003 06:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:30 AM.