ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple (https://www.excelbanter.com/excel-programming/377779-simple.html)

Steph

Simple
 
Hi all. How can I have excel clear contents in the range E30:AE30, then
copy E15:AE15 and paste special values in E30:AE30 in two specific sheets in
a workbook (sheet1, sheet2)? The clearing, copying and pasting I can get
through the recorder, but how can I get the code to loop through the 2
sheets? Thanks!



ufo_pilot

Simple
 


Sub Macro1()
Range("E30:AE30").Select
Selection.ClearContents
Range("E15:AE15").Select
Selection.Copy
Range("E30:AE30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Sheet2").Select
Range("E30:AE30").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("E15:AE15").Select
Selection.Copy
Range("E30:AE30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub


"Steph" wrote:

Hi all. How can I have excel clear contents in the range E30:AE30, then
copy E15:AE15 and paste special values in E30:AE30 in two specific sheets in
a workbook (sheet1, sheet2)? The clearing, copying and pasting I can get
through the recorder, but how can I get the code to loop through the 2
sheets? Thanks!




Don Guillett

Simple
 
Change the names and try this from anywhere in the workbook.

sheets("desinationsheet1").Range("E30:AE30").value = _
sheets('sourcesheet").Range("E15:AE15").value
sheets("desinationsheet2").Range("E30:AE30").value = _
sheets('sourcesheet").Range("E15:AE15").value

--
Don Guillett
SalesAid Software

"ufo_pilot" wrote in message
...


Sub Macro1()
Range("E30:AE30").Select
Selection.ClearContents
Range("E15:AE15").Select
Selection.Copy
Range("E30:AE30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Sheet2").Select
Range("E30:AE30").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("E15:AE15").Select
Selection.Copy
Range("E30:AE30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub


"Steph" wrote:

Hi all. How can I have excel clear contents in the range E30:AE30, then
copy E15:AE15 and paste special values in E30:AE30 in two specific sheets
in
a workbook (sheet1, sheet2)? The clearing, copying and pasting I can get
through the recorder, but how can I get the code to loop through the 2
sheets? Thanks!







All times are GMT +1. The time now is 06:17 AM.

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