copy/paste

  • Thread starter Thread starter Lee
  • Start date Start date
L

Lee

In macro, the following will do copy and paste, but what
is I need the index 7 and 14 below to be a variable?

Range("C7:D14").Select
Selection.Copy
Range("F2").Select
ActiveSheet.Paste
 
Dim m As Long
Dim n As Long

Range("C" & CStr(m) & ":D" & CStr(n)).Select
Selection.Copy
Range("F2").Select
ActiveSheet.Paste
 
Dim r1 As Long, c1 As Long, r2 As Long, c2 As Long
r1 = 7: c1 = 3: r2 = 14: c2 = 4
Range(Cells(r1, c1), Cells(r2, c2)).Copy Range("F2")
 

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

Back
Top