![]() |
Copying Variable Ranges
With Worksheets("Sheet2")
..Range(.Range("C1"), .Range("H1").End(xlDown)).Copy End With Range("K7").PasteSpecial You need to qualify all range references to point to sheet2. -- Regards, Tom Ogilvy "Alec" wrote in message ... The following code works for copying a range from C1 up to the first blank in column H; Range("C1", Range("H1").End(xlDown)).Copy Range("K7").PasteSpecial But when I try the following code to copy the same amount of data from sheet 2 I get an error message. Worksheets("Sheet2").Range("C1", Range("H1").End (xlDown)).Copy Range("K7").PasteSpecial Any ideas. Thanks Alec |
Copying Variable Ranges
Thanks Tom
This works fine with more than one row, but if the second row is empty, I get the first three rows pasted instead of just the first. Also if I just have one row I get the whole 65536 rows. Any ideas how this could be avoided. Thanks Again Alec -----Original Message----- With Worksheets("Sheet2") ..Range(.Range("C1"), .Range("H1").End(xlDown)).Copy End With Range("K7").PasteSpecial You need to qualify all range references to point to sheet2. -- Regards, Tom Ogilvy "Alec" wrote in message ... The following code works for copying a range from C1 up to the first blank in column H; Range("C1", Range("H1").End(xlDown)).Copy Range("K7").PasteSpecial But when I try the following code to copy the same amount of data from sheet 2 I get an error message. Worksheets("Sheet2").Range("C1", Range("H1").End (xlDown)).Copy Range("K7").PasteSpecial Any ideas. Thanks Alec . |
Copying Variable Ranges
With Worksheets("Sheet2")
..Range(.Range("C1"), .Range("H65536").End(xlUp)).Copy End With Range("K7").PasteSpecial -- Regards, Tom Ogilvy "Alec" wrote in message ... Thanks Tom This works fine with more than one row, but if the second row is empty, I get the first three rows pasted instead of just the first. Also if I just have one row I get the whole 65536 rows. Any ideas how this could be avoided. Thanks Again Alec -----Original Message----- With Worksheets("Sheet2") ..Range(.Range("C1"), .Range("H1").End(xlDown)).Copy End With Range("K7").PasteSpecial You need to qualify all range references to point to sheet2. -- Regards, Tom Ogilvy "Alec" wrote in message ... The following code works for copying a range from C1 up to the first blank in column H; Range("C1", Range("H1").End(xlDown)).Copy Range("K7").PasteSpecial But when I try the following code to copy the same amount of data from sheet 2 I get an error message. Worksheets("Sheet2").Range("C1", Range("H1").End (xlDown)).Copy Range("K7").PasteSpecial Any ideas. Thanks Alec . |
Copying Variable Ranges
Thanks Again Tom
-----Original Message----- With Worksheets("Sheet2") ..Range(.Range("C1"), .Range("H65536").End(xlUp)).Copy End With Range("K7").PasteSpecial -- Regards, Tom Ogilvy "Alec" wrote in message ... Thanks Tom This works fine with more than one row, but if the second row is empty, I get the first three rows pasted instead of just the first. Also if I just have one row I get the whole 65536 rows. Any ideas how this could be avoided. Thanks Again Alec -----Original Message----- With Worksheets("Sheet2") ..Range(.Range("C1"), .Range("H1").End(xlDown)).Copy End With Range("K7").PasteSpecial You need to qualify all range references to point to sheet2. -- Regards, Tom Ogilvy "Alec" wrote in message ... The following code works for copying a range from C1 up to the first blank in column H; Range("C1", Range("H1").End(xlDown)).Copy Range("K7").PasteSpecial But when I try the following code to copy the same amount of data from sheet 2 I get an error message. Worksheets("Sheet2").Range("C1", Range("H1").End (xlDown)).Copy Range("K7").PasteSpecial Any ideas. Thanks Alec . . |
All times are GMT +1. The time now is 02:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com