Worksheets Macro

  • Thread starter Thread starter Workbook
  • Start date Start date
W

Workbook

I am trying to create a code that, when I run it from Sheet 1, it will

1. Clear the contents in cells C10 and E10 on Sheet 2
2. Copy the contents in cells C7 and E7 on Sheet1
3. Paste the contents from cells C7 and E7 on Sheet 1 into C10 and E10 on
Sheet 2
4. Finish with Sheet 2 as the active worksheet.

Can you help me out with this?
 
Something like

with sheets("sheet2")
sheets("sheet1").copy range("c7").range("c10)
sheets("sheet1").copy range("e7").range("e10)
'uncomment line below to activate sheet2
..select
end with
 
You can run this from any sheet.

Sub copy()
Sheets("Sheet2").Range("C10", "E10").Value = _
Sheets("Sheet1").Range("C7", "E7").Value
Sheets("Sheet2").Activate
End Sub

No need to clear/copy/paste.


Gord Dibben MS Excel MVP
 
Thank you Gord. I also appreciate your help very much. I am sorry for the
delay. The code was very helpful to me. Thank you.
 

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