ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheets Macro (https://www.excelbanter.com/excel-programming/418215-worksheets-macro.html)

Workbook

Worksheets Macro
 
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?


Don Guillett

Worksheets Macro
 
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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Workbook" wrote in message
...
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?



Gord Dibben

Worksheets Macro
 
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

On Tue, 7 Oct 2008 15:37:02 -0700, Workbook
wrote:

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?



Workbook

Worksheets Macro
 
Thank you Don. My apologies for the delay. This was very helpful.

"Don Guillett" wrote:

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Workbook" wrote in message
...
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?




Workbook

Worksheets Macro
 
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.

"Gord Dibben" wrote:

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

On Tue, 7 Oct 2008 15:37:02 -0700, Workbook
wrote:

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?





All times are GMT +1. The time now is 07:08 PM.

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