ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Copy Cells - using Variable (https://www.excelbanter.com/excel-discussion-misc-queries/237309-copy-cells-using-variable.html)

dhstein

Copy Cells - using Variable
 
I want to copy cells from one row to another using the row number and column
number of both source and destination. Example: copy FROM row 10 column 20
through row 10 column 30 TO row 100 column 50.

This is a clarification to my previous post. I want to use a variable to do
this. So 10, 20, 30, 50 and 100 will be variables. Can anyone provide the
syntax for that? Thanks for any help on this.

Don Guillett

Copy Cells - using Variable
 
Like this?

Sub copyvariablerows()
fr = 10
fc = 20
fco = 30
dr = 100
dc = 50
Range(Cells(fr, fc), Cells(fr, fco)).Copy Cells(dr, dc)
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"dhstein" wrote in message
...
I want to copy cells from one row to another using the row number and
column
number of both source and destination. Example: copy FROM row 10 column 20
through row 10 column 30 TO row 100 column 50.

This is a clarification to my previous post. I want to use a variable to
do
this. So 10, 20, 30, 50 and 100 will be variables. Can anyone provide the
syntax for that? Thanks for any help on this.



FSt1

Copy Cells - using Variable
 
hi
another way??
Sub ctest()
Dim r As Range
Dim ro As Range
Set r = Range(Cells(10, 20), Cells(10, 30))
Set ro = Cells(100, 50)
r.Copy ro
End Sub

regards
FSt1

"dhstein" wrote:

I want to copy cells from one row to another using the row number and column
number of both source and destination. Example: copy FROM row 10 column 20
through row 10 column 30 TO row 100 column 50.

This is a clarification to my previous post. I want to use a variable to do
this. So 10, 20, 30, 50 and 100 will be variables. Can anyone provide the
syntax for that? Thanks for any help on this.


dhstein

Copy Cells - using Variable
 
Thanks for the answers

"dhstein" wrote:

I want to copy cells from one row to another using the row number and column
number of both source and destination. Example: copy FROM row 10 column 20
through row 10 column 30 TO row 100 column 50.

This is a clarification to my previous post. I want to use a variable to do
this. So 10, 20, 30, 50 and 100 will be variables. Can anyone provide the
syntax for that? Thanks for any help on this.



All times are GMT +1. The time now is 03:11 PM.

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