PDA

View Full Version : Write a value from a cell formula



rolo
07-21-2010, 06:30 AM
I need a macro to write the value 500 from A1 formula.

For example:

- If A1 fórmula is =R10, then macro should write value 500 in R10
- If A1 fórmula is =J30, then macro should write value 500 in J30

Is it possible to do this?

Thanks a lot!

Simon Lloyd
07-21-2010, 06:57 AM
I cant for the life of me think why you would want to do that but:Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("A1").HasFormula Then
Range(Right(Range("A1").Formula, Len(Range("A1").Formula) - 1)) = 500
End If
End Sub