I didn't notice that you wanted to pass the operand, too
Option Explicit
Sub myFormlae2()
Dim myRng As Range
Dim myCell As Range
Dim myVal As String
myVal = InputBox(Prompt:="Enter a String")
If Trim(myVal) = "" Then
Exit Sub 'user hit cancel
End If
Set myRng = Selection
For Each myCell In myRng.Cells
With myCell
If .HasFormula Then
.Formula = "=(" & Mid(.Formula, 2) & ")" & myVal
Else
.Formula = "=" & .Formula & myVal
End If
End With
Next myCell
End Sub
Don't put the equal sign.
ian123 wrote:
I'm entering "=+1" into the input box (for example). This simply
returns the value 1 to the selected cell rather than apply +1 to the
value already in the cell. Any ideas where i'm going wrong?
---
Message posted from http://www.ExcelForum.com/
--
Dave Peterson