Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Copying Range gives object defined run wrror


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Copying Range gives object defined run wrror

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" wrote in message ps.com...

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Copying Range gives object defined run wrror

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)


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Copying Range gives object defined run wrror

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" wrote in message ups.com...
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)


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Copying Range gives object defined run wrror

Worked Great - Thanks


On Apr 19, 1:40 pm, "Ron de Bruin" 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" wrote in oglegroups.com...
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
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
Run-time error '50290': Application-defined or object-defined erro Macro button Excel Discussion (Misc queries) 1 March 12th 09 10:59 AM
ASSIGNING THE VALUE TO A NAMED RANGE GIVING OBJECT DEFINED ERROR CAPTGNVR Excel Programming 8 February 16th 07 05:13 PM
Application-defined or object-defined error (worksheet, range, sel darxoul Excel Programming 4 August 2nd 06 01:59 PM
Copying A Range of Cells From one Sheet to Another - Error Application Defined or Object Defined Matt[_39_] Excel Programming 3 July 25th 06 01:13 AM
Range - Application Defined or Object Defined Error Dyl Excel Programming 6 October 31st 05 07:57 PM


All times are GMT +1. The time now is 01:10 PM.

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

About Us

"It's about Microsoft Excel"