Jordan
Jordan

Reputation: 697

VBA - Copying and Altering Value

I'm currentlying copying values from one sheet to another sheet using:

Worksheets("Source").Range("D2:D" & Last_Index_F).Copy Worksheets("Tabell7").Range("C2")

The values I'm copying are numerical values. For each and every value I copy, I want to add 2. It there a way of doing this directly instead of going through the column (using For or While) and adding 2?

Upvotes: 0

Views: 35

Answers (1)

Wolfie
Wolfie

Reputation: 30155

Instead of copying, just assign the Value directly...

Worksheets("Tabell7").Range("C2").Value =  _ 
    Worksheets("Source").Range("D2:D" & Last_Index_F).Value + 2 

You will find this is also much quicker, as it avoids writing and retrieving data from the clipboard!

Upvotes: 2

Related Questions