darkfreedoom
New Member
- Joined
- Nov 1, 2011
- Messages
- 30
Dear Mr/Ms,
I would like to create a VBA to edit my excel cells' formula by adding some info to the starting & ending of the formula.
I created this but it doesn't work:
if I change i = Cells(Lrow, Scol) ,
it run, but it paste the value of the cell.
i want it to paste the formula back.
Any idea?
Thanks in advance.
Regards
Vincent
WinXP / MSExcel07
I would like to create a VBA to edit my excel cells' formula by adding some info to the starting & ending of the formula.
I created this but it doesn't work:
Rich (BB code):
Dim Srow, Erow, Lrow, Scol, Ecol, Lcol
Srow = Selection.Row
Erow = Srow + Selection.Rows.Count - 1
Scol = Selection.Column
Ecol = Scol + Selection.Columns.Count - 1
For Lrow = Srow To Erow Step 1
Dim i
i = Cells(Lrow, Scol).FormulaR1C1
If IsEmpty(i) Then
GoTo CSub
Else
Cells(Lrow, Scol).FormulaR1C1 = "=Round(" & i & ",2)"
End If
CSub:
Next Lrow
if I change i = Cells(Lrow, Scol) ,
it run, but it paste the value of the cell.
i want it to paste the formula back.
Any idea?
Thanks in advance.
Regards
Vincent
WinXP / MSExcel07