Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
PasteSpecial macro
Good evening,
Need some help to clean up the recorded macro below. Sheet1 is the ActiveSheet. Trying to paste the values of Range("A1:A10") to Sheet2. Cant find out the right syntax. Thankful for any hints. Brgds CG Rosén --------------------------------------------------------------------- Sheets("Sheet1").Select Range("A1:A10").Select Selection.Copy Sheets("Sheet2").Select Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
PasteSpecial macro
Sheets("Sheet1").Range("A1:A10").Copy
Sheets("Sheet2").Range("A1").PasteSpecial _ Paste:=xlPasteValues, _ Operation:=xlNone, _ SkipBlanks:=False, _ Transpose:=False Doesn't make any difference which sheet is the activesheet. Sheets("Sheet2").Range("A1:A10").Value = _ Sheets("Sheet1).Range("A1:A10").Value is another way to do it. -- Regards, Tom Ogilvy CG Rosén wrote in message ... Good evening, Need some help to clean up the recorded macro below. Sheet1 is the ActiveSheet. Trying to paste the values of Range("A1:A10") to Sheet2. Cant find out the right syntax. Thankful for any hints. Brgds CG Rosén --------------------------------------------------------------------- Sheets("Sheet1").Select Range("A1:A10").Select Selection.Copy Sheets("Sheet2").Select Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
PasteSpecial macro
Maybe:
Option Explicit Sub testme02() Dim rng As Range Set rng = Worksheets("sheet1").Range("a1:a10") rng.Copy Worksheets("sheet2").Range("a1").PasteSpecial Paste:=xlPasteValues End Sub but you could just assign the value, too: Sub testme02() Dim rng As Range Set rng = Worksheets("sheet1").Range("a1:a10") Worksheets("sheet2").Range("A1") _ .Resize(rng.Rows.Count, rng.Columns.Count).Value _ = rng.Value End Sub "CG Rosén" wrote: Good evening, Need some help to clean up the recorded macro below. Sheet1 is the ActiveSheet. Trying to paste the values of Range("A1:A10") to Sheet2. Cant find out the right syntax. Thankful for any hints. Brgds CG Rosén --------------------------------------------------------------------- Sheets("Sheet1").Select Range("A1:A10").Select Selection.Copy Sheets("Sheet2").Select Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
PasteSpecial macro
CG
You do not have to copy the data, this will perform the same action Sub pasteValues() Sheets("Sheet2").Range("A1:A10").Value = _ Sheets("Sheet1").Range("A1:A10") End Sub Regards Peter -----Original Message----- Good evening, Need some help to clean up the recorded macro below. Sheet1 is the ActiveSheet. Trying to paste the values of Range("A1:A10") to Sheet2. Cant find out the right syntax. Thankful for any hints. Brgds CG Rosén ---------------------------------------------------------- ----------- Sheets("Sheet1").Select Range("A1:A10").Select Selection.Copy Sheets("Sheet2").Select Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
vba pastespecial | Excel Programming | |||
PasteSpecial problem | Excel Programming | |||
A More Effective Way of Using PasteSpecial? | Excel Programming | |||
PasteSpecial:VBA vs right click | Excel Programming | |||
pastespecial | Excel Programming |