ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Strange Range copying (https://www.excelbanter.com/excel-programming/440276-strange-range-copying.html)

David Macdonald

Strange Range copying
 
This copies the range once:
Sheets("Sheet1").Range("B3:P3").Copy Sheets("Sheet3").Rows(8)

This copies the range repeatedly to the end of the row:
Sheets("Sheet1").Range("B3:Q3").Copy Sheets("Sheet3").Rows(8)

Why? Is there a limit of 15 columns?

--
WinXP - Office2003 (Italian)

Dave Peterson

Strange Range copying
 
First, I can't think a time where not specifying the entire range that I want
pasted is a good idea.
If I want it pasted just a single time, I'd use:
Sheets("Sheet1").Range("B3:P3").Copy Sheets("Sheet3").Range("A8")
or multiple times:
Sheets("Sheet1").Range("B3:P3").Copy Sheets("Sheet3").Range("a9:ad9")

=======
I don't think it's a limit in the number of columns. I think it's excel trying
to help.

Since B3:q3 is 16 columns and 16 is an integer divisor into the number of
columns that xl2003 has (256), excel says: I know you want to fill the entire
row--since you told me to!

But B3:P3 is only 15 columns and 15 is not an integer divisor into 256, excel
says: Well, I can't fill the row exactly, so I'll just do one.

If you change your ranges to be 2 columns and 3 columns, you'll see the same
thing happen.

David Macdonald wrote:

This copies the range once:
Sheets("Sheet1").Range("B3:P3").Copy Sheets("Sheet3").Rows(8)

This copies the range repeatedly to the end of the row:
Sheets("Sheet1").Range("B3:Q3").Copy Sheets("Sheet3").Rows(8)

Why? Is there a limit of 15 columns?

--
WinXP - Office2003 (Italian)


--

Dave Peterson

David Macdonald

Strange Range copying
 
Damn you to hell Excel for being so helpful!
--
WinXP - Office2003 (Italian)


"Dave Peterson" wrote:

First, I can't think a time where not specifying the entire range that I want
pasted is a good idea.
If I want it pasted just a single time, I'd use:
Sheets("Sheet1").Range("B3:P3").Copy Sheets("Sheet3").Range("A8")
or multiple times:
Sheets("Sheet1").Range("B3:P3").Copy Sheets("Sheet3").Range("a9:ad9")

=======
I don't think it's a limit in the number of columns. I think it's excel trying
to help.

Since B3:q3 is 16 columns and 16 is an integer divisor into the number of
columns that xl2003 has (256), excel says: I know you want to fill the entire
row--since you told me to!

But B3:P3 is only 15 columns and 15 is not an integer divisor into 256, excel
says: Well, I can't fill the row exactly, so I'll just do one.

If you change your ranges to be 2 columns and 3 columns, you'll see the same
thing happen.

David Macdonald wrote:

This copies the range once:
Sheets("Sheet1").Range("B3:P3").Copy Sheets("Sheet3").Rows(8)

This copies the range repeatedly to the end of the row:
Sheets("Sheet1").Range("B3:Q3").Copy Sheets("Sheet3").Rows(8)

Why? Is there a limit of 15 columns?

--
WinXP - Office2003 (Italian)


--

Dave Peterson
.



All times are GMT +1. The time now is 10:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com