PDA

View Full Version : Solved: Copy Formula from cell above and Paste only values: help required



satish gubbi
07-04-2012, 08:55 AM
Hi,

I need a code, which will copy formula from given cell reference and paste the values to entire correspoding cells

Attached is sample file with the requirement.

kindly help.

Bob Phillips
07-04-2012, 10:55 AM
Dim lastrow
With ActiveSheet

lastrow = .Range("A3").End(xlDown).Row
With .Range("D4").Resize(lastrow - 3)

ActiveSheet.Range("D2").Copy .Cells
.Value = .Value
End With
End With

satish gubbi
07-04-2012, 11:13 PM
Hi Xld,

awesome, this code is working fine.

thank you very much for your help.

Regards,

satish gubbi
07-06-2012, 08:17 PM
hi
Can we have small modification, Formula should be copied if the cell value is blank

Regards

Bob Phillips
07-07-2012, 01:59 AM
Dim lastrow
With ActiveSheet

lastrow = .Range("A3").End(xlDown).Row
With .Range("D4").Resize(lastrow - 3).SpecialCells(xlCellTypeBlanks)

ActiveSheet.Range("D2").Copy .Cells
.Value = .Value
End With
End With

satish gubbi
07-07-2012, 06:45 AM
Hi Xld,

its working fine as intended. As your profile tag line states you are "Distinguished Lord of VBAX"

Regards