I have the below code that works:
But, I would like to be able to input a smaller value in TexBox2, such as 3.0, and then multiply it by 100,000,000,000. So in the case above if 3.0 was entered into Textbox2, "260000000000," would be replaced by "300000000000,".
When I try the code below I encounter a Run time error '13': Type mismatch.
Code:
Private Sub CommandButton1_Click()
Dim cell As Range
For Each cell In Range("I2:I2")
cell.Formula = Replace(cell.Formula, "100,", TextBox1.Value + ",")
cell.Formula = Replace(cell.Formula, "260000000000,", TextBox2.Value + ",")
Next cell
End Sub
But, I would like to be able to input a smaller value in TexBox2, such as 3.0, and then multiply it by 100,000,000,000. So in the case above if 3.0 was entered into Textbox2, "260000000000," would be replaced by "300000000000,".
When I try the code below I encounter a Run time error '13': Type mismatch.
Code:
Private Sub CommandButton1_Click()Dim cell As Range
For Each cell In Range("I2:I2")
cell.Formula = Replace(cell.Formula, "100,", TextBox1.Value + ",")
cell.Formula = Replace(cell.Formula, "260000000000,", TextBox2.Value * 100000000000# + ",")
Next cell
End Sub