user2567545
user2567545

Reputation: 11

Macro to copy values only from one sheet to another

I've this VBA code

Sheets("log").Range("A125:f1000").Copy _ 
Sheets("data").Cells(Rows.Count, "A").End(xlUp).Offset(1)

and it copies perfectly from sheet log to data. The only problem I'm facing is that it copies formulas with it as well whereas I only want values. I want to use same VBA code with some modifications to paste values only.

Upvotes: 1

Views: 25385

Answers (2)

LS_ᴅᴇᴠ
LS_ᴅᴇᴠ

Reputation: 11151

Without using clipboard:

Sheets("data").Cells(Rows.Count, "A").End(xlUp).Offset(1).Value = Sheets("log").Range("A125:f1000").Value

Upvotes: 10

user2140173
user2140173

Reputation:

Need to add PasteSpecial Paste:=xlPasteValues

Next time try Recording a macro and modifying the code

Sheets("log").Range("A125:f1000").Copy
Sheets("data").Cells(Rows.Count, "A").End(xlUp).Offset(1). _ 
PasteSpecial Paste:=xlPasteValues, _ 
Operation:=xlNone, SkipBlanks:=False, Transpose:=False

Upvotes: 2

Related Questions