Back Forum Reply New

copy amp; add

Hello,     Is there a way to make excel copy and paste but add a numerical value to the cell reference example b1 value of cell 20 copy paste to  b2 new value 60 and so on . Thanks for your help


Code:
Sub copypste()
Range("B2").Value = Range("B1").Value + 40
End Sub
Hope this helps

Sounds like you might be interested in paste special Add.

If you want to do this for a range of cells, say A1:A30 try this

Sub copyaddloop()
Dim i As Integer
'adds 40 to value in col A amp; places in ColB
'for A1:A30
For i = 1 To 30
Cells(i, 2).Value = Cells(i, 1).Value + 40
Next i
End SubHope this helps

Edit.... of course PasteSpecial > Add will do just as well.... guess it depends if you're after an automated solution or a more manual one...

Thanks for your help
¥
Back Forum Reply New