Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Paste ranges with offset Excel 2000

Hello,

I¨m working with copyinf and pasting cell in differents sheets, and
ait works well but when I try to do the same with range I have
problems.

I use this code.
-------------------------------
Range("B2").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value =
Workbooks("ReportRP.xls").Sheets("PS").Range("D13: D15")

ActiveCell.Offset(0, -1) = _
Workbooks("ReportRP.xls").Sheets("PS").Range("I6:I 10")
____________________________________

the same code refering only to one cell works well, I think the problem
is the Offset, can I change it??.

Thanks in advance.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Paste ranges with offset Excel 2000

The problem with these lines is that you are trying to set one cell (the
active cell) equal to 3 cells (D13:D15).

ActiveCell.Value =
Workbooks("ReportRP.xls").Sheets("PS").Range("D13: D15")
ActiveCell.Offset(0, -1) = _
Workbooks("ReportRP.xls").Sheets("PS").Range("I6:I 10")


If you wanted to put the 3 cells at the bottom of the list, then you could
use

ActiveCell.RANGE("A1:A3").Value =
Workbooks("ReportRP.xls").Sheets("PS").Range("D13: D15").VALUE

This would place the cells D13:D15 into the active cell and the 2 cells
below it (the A1:A3 bit is relative to the activeCell)
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Paste ranges with offset Excel 2000

I can't see any problems with the code (apart from testing for blank at the
start of the loop in case B2 is empty), but this is a more efficient way of
doing it

With Range("B2").End(xlDown).Offset(1, 0)
.Value = Workbooks("ReportRP.xls").Sheets("PS").Range("D13: D15")
.Offset(0, -1) = _
Workbooks("ReportRP.xls").Sheets("PS").Range("I6:I 10")
End With


--
HTH

Bob Phillips

"carloshernandezy" wrote in message
ups.com...
Hello,

I¨m working with copyinf and pasting cell in differents sheets, and
ait works well but when I try to do the same with range I have
problems.

I use this code.
-------------------------------
Range("B2").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value =
Workbooks("ReportRP.xls").Sheets("PS").Range("D13: D15")

ActiveCell.Offset(0, -1) = _
Workbooks("ReportRP.xls").Sheets("PS").Range("I6:I 10")
____________________________________

the same code refering only to one cell works well, I think the problem
is the Offset, can I change it??.

Thanks in advance.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Paste ranges with offset Excel 2000

Oops, missed the treble cell bit (I commented it out in my tests).

That as well, the approach is more efficient.

--
HTH

Bob Phillips

"Bob Phillips" wrote in message
...
I can't see any problems with the code (apart from testing for blank at

the
start of the loop in case B2 is empty), but this is a more efficient way

of
doing it

With Range("B2").End(xlDown).Offset(1, 0)
.Value = Workbooks("ReportRP.xls").Sheets("PS").Range("D13: D15")
.Offset(0, -1) = _
Workbooks("ReportRP.xls").Sheets("PS").Range("I6:I 10")
End With


--
HTH

Bob Phillips

"carloshernandezy" wrote in message
ups.com...
Hello,

I¨m working with copyinf and pasting cell in differents sheets, and
ait works well but when I try to do the same with range I have
problems.

I use this code.
-------------------------------
Range("B2").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value =
Workbooks("ReportRP.xls").Sheets("PS").Range("D13: D15")

ActiveCell.Offset(0, -1) = _
Workbooks("ReportRP.xls").Sheets("PS").Range("I6:I 10")
____________________________________

the same code refering only to one cell works well, I think the problem
is the Offset, can I change it??.

Thanks in advance.




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
Dynamic Ranges and Offset RFJ Excel Worksheet Functions 3 August 29th 06 03:20 PM
Using Offset with named ranges StanJ Excel Worksheet Functions 5 September 2nd 05 09:07 AM
Ranges using offset Fatir Zelen Excel Programming 11 April 24th 04 11:15 PM
Different passwords to separate ranges in excel 2000 Parhelion Excel Programming 2 February 9th 04 08:49 PM
How do I copy and paste ranges from VB 6.0 in an Excel spreadsheet? Colin Colin Excel Programming 0 January 19th 04 06:30 PM


All times are GMT +1. The time now is 09:03 AM.

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"