Copy Cells - using Variable

D

dhstein

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.
 
D

Don Guillett

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
 
F

FSt1

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top