Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default copy range from one sheet to another - basic doubt

Hi,

I have a problem in which I have to copy the values in a range of
cells ( this range is dynamic and decided at run time) from worksheet
1 to worksheet 3. Then the control must return to worksheet 1.


Any suggestions on how to do this would be highly appreciated.

Thanks and Happy New Year

Rohith Kori
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default copy range from one sheet to another - basic doubt

more info needed. You do not need to goto the destination sheet. The basic
idea is
[destinationsheet!a1].value=[sourcesheet!a1].value

--
Don Guillett
SalesAid Software

"Rohith Kori" wrote in message
om...
Hi,

I have a problem in which I have to copy the values in a range of
cells ( this range is dynamic and decided at run time) from worksheet
1 to worksheet 3. Then the control must return to worksheet 1.


Any suggestions on how to do this would be highly appreciated.

Thanks and Happy New Year

Rohith Kori



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default copy range from one sheet to another - basic doubt

Hi Don,

Sorry for not giving the complete details.

I have a range of values B23:O36 on sheet 1 which I need to copy into
Sheet 3.

The problem is that the range on sheet 1 has certain validations ( only
numbers allowed ) and formatting ( color change on entering data )
associated with it. So when I try the

worksheets("sheet1").range("b23:O36").copy _
destination:=worksheets("sheet3").range("b23:O36")

it gives an error, subscript out of range.

When I run the same code for cells which do not have any formatting it
works.

Any suggestions on how to overcome this problem.

Thanks
Rohith





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default copy range from one sheet to another - basic doubt

Are you sure your activeworkbook is the one you think it is?

Typically, subscript out of range errors are caused by not having the names of
sheets that you think you have. (Check for leading/trailing spaces if you're
positive you're running the code against the correct workbook.)

Your code worked ok for me when I had data|validation and format|conditional
formatting in the range to be copied.



Rohith Kori wrote:

Hi Don,

Sorry for not giving the complete details.

I have a range of values B23:O36 on sheet 1 which I need to copy into
Sheet 3.

The problem is that the range on sheet 1 has certain validations ( only
numbers allowed ) and formatting ( color change on entering data )
associated with it. So when I try the

worksheets("sheet1").range("b23:O36").copy _
destination:=worksheets("sheet3").range("b23:O36")

it gives an error, subscript out of range.

When I run the same code for cells which do not have any formatting it
works.

Any suggestions on how to overcome this problem.

Thanks
Rohith

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


--

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
copy cell range in other sheet kalpesh Excel Worksheet Functions 1 December 30th 11 08:28 PM
How to Copy range of Row heights from one sheet to another in XL? Suby Mathews Excel Worksheet Functions 1 January 8th 09 08:20 AM
visual basic. find copy row past into new sheet Chuck Excel Worksheet Functions 3 December 17th 07 09:02 PM
Copy range and past on another sheet gumby Excel Worksheet Functions 3 July 17th 07 11:54 PM
How to apply OFFSET as the range in a basic 'Copy' process... cdavidson Excel Discussion (Misc queries) 4 November 8th 05 08:43 PM


All times are GMT +1. The time now is 06:41 PM.

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"