Just a note first, your sheet range formulas can be simplified
IF TRIM(Sheets("Income Expense 2007").RANGE("A" & rownum)) ="" THEN
will work just as your current formula does
And yes, you can do what you want -
Sheets("Income Expense 2007").Range("B7") = Tb1.Value + _
Sheets("Income Expense 2007").Range("B7")
Except during testing of things for equality, the = symbol in
VB (and all
dialects of Basic that I am familiar with) actually does not mean "equal to",
it means "set the value of the left side of the equation to the results of
the operations on the right side of the equation. A fine distinction, but
allows you to do things like:
X = 5
X = X + 6
at which point X will have a value of 11.
"Hazel" wrote:
Hi All
Using the following code below my userform adds to the designated sheet if
there is a value already in the cell is it possible for the new value added
in Tb1 to add to the value already in the cell and show the new value in the
same cell. e.g the cell B7 has a value of 100 and I add 200 in Tb1 then click
on Add1 cell B7 would then show 300.
Private Sub Add1_Click()
startrownum = 7
endrownum = 25
For rownum = startrownum To endrownum
If Trim(Sheets("Income Expense 2007").Range("A" & Trim(Str(rownum)))) =
"" Then
freerownum = rownum
rownum = endrownum
End If
Next rownum
Sheets("Income Expense 2007").Range("A" & Trim(Str(freerownum))) = Com1.Value
Sheets("Income Expense 2007").Range("B7") = Tb1.Value
End Sub
--
Many thanks
hazel