ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   different ways to copy a range? (https://www.excelbanter.com/excel-programming/369658-different-ways-copy-range.html)

botha822[_3_]

different ways to copy a range?
 

Whats wrong with this syntax?
WsName is a string variable that is assigned the name of a worksheet
exists.
n and i are both integer variables that are based off of For
statements.

Worksheets(WsName).Range(Cells(5, n), Cells(2415, n)).Copy _
Destination:=Worksheets("Summary").Cells(4, i)

Thanks!


--
botha822
------------------------------------------------------------------------
botha822's Profile: http://www.excelforum.com/member.php...o&userid=36752
View this thread: http://www.excelforum.com/showthread...hreadid=569175


ducky

different ways to copy a range?
 

botha822 wrote:
Whats wrong with this syntax?
WsName is a string variable that is assigned the name of a worksheet
exists.
n and i are both integer variables that are based off of For
statements.

Worksheets(WsName).Range(Cells(5, n), Cells(2415, n)).Copy _
Destination:=Worksheets("Summary").Cells(4, i)


Where is your code bugging? Are you sure your variables are being
assigned? i think you should post all of your code

AR


Ron de Bruin

different ways to copy a range?
 
Cells use not the cells of the activesheet

Use it like this

Worksheets(wsname).Range(Worksheets(wsname).Cells( 5, n), Worksheets(wsname).Cells(2415, n)).Copy _
Destination:=Worksheets("Summary").Cells(4, i)


--
Regards Ron de Bruin
http://www.rondebruin.nl



"botha822" wrote in message
...

Whats wrong with this syntax?
WsName is a string variable that is assigned the name of a worksheet
exists.
n and i are both integer variables that are based off of For
statements.

Worksheets(WsName).Range(Cells(5, n), Cells(2415, n)).Copy _
Destination:=Worksheets("Summary").Cells(4, i)

Thanks!


--
botha822
------------------------------------------------------------------------
botha822's Profile: http://www.excelforum.com/member.php...o&userid=36752
View this thread: http://www.excelforum.com/showthread...hreadid=569175




botha822[_4_]

different ways to copy a range?
 

hey thanks for the advice guys. Both replies were useful in differen
ways. Any other online resources for learning VBA for Excel? I know
don't write very clean code and I would like to improve some more.

Thanks again

--
botha82
-----------------------------------------------------------------------
botha822's Profile: http://www.excelforum.com/member.php...fo&userid=3675
View this thread: http://www.excelforum.com/showthread.php?threadid=56917


Dave Peterson

different ways to copy a range?
 
David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

And he has links to lots of other sites.



botha822 wrote:

hey thanks for the advice guys. Both replies were useful in different
ways. Any other online resources for learning VBA for Excel? I know I
don't write very clean code and I would like to improve some more.

Thanks again.

--
botha822
------------------------------------------------------------------------
botha822's Profile: http://www.excelforum.com/member.php...o&userid=36752
View this thread: http://www.excelforum.com/showthread...hreadid=569175


--

Dave Peterson


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

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