ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   adding to a number already in a cell (https://www.excelbanter.com/excel-programming/307995-re-adding-number-already-cell.html)

Rodney POWELL

adding to a number already in a cell
 
Conrad -- something like this ...


Sub AddMore()

With Worksheets("MySheet").Range("A1")

.Value = .Value + 1

End With

End Sub


--

Hope it Helps,

- Rodney POWELL
Microsoft MVP - Excel

Beyond Technology
Spring, Texas USA
www.BeyondTechnology.com



"conrad" wrote in message ...
I am working on a basic worksheet. I have several numbers which I have to
add additional number to in that cell. I want the cell to reflect the total
and the display of the cell contents to list the individual numbers added.


JulieD

adding to a number already in a cell
 
Hi Rodney

won't this change the value stored in cell A1 rather than "the display of the cell contents to list the individual numbers added" ?

Cheers
JulieD

"Rodney POWELL" wrote in message ...
Conrad -- something like this ...


Sub AddMore()

With Worksheets("MySheet").Range("A1")

.Value = .Value + 1

End With

End Sub


--

Hope it Helps,

- Rodney POWELL
Microsoft MVP - Excel

Beyond Technology
Spring, Texas USA
www.BeyondTechnology.com



"conrad" wrote in message ...
I am working on a basic worksheet. I have several numbers which I have to
add additional number to in that cell. I want the cell to reflect the total
and the display of the cell contents to list the individual numbers added.


Norman Jones

adding to a number already in a cell
 
Hi Rodney,

I think you missed:

display of the cell contents to list the individual numbers added.


Perhaps, change:

.Value = .Value + 1

to:

.Formula = "=" & .Formula & "+1"


---
Regards,
Norman



"Rodney POWELL" wrote in message
...
Conrad -- something like this ...


Sub AddMore()

With Worksheets("MySheet").Range("A1")

.Value = .Value + 1

End With

End Sub


--

Hope it Helps,

- Rodney POWELL
Microsoft MVP - Excel

Beyond Technology
Spring, Texas USA
www.BeyondTechnology.com



"conrad" wrote in message
...
I am working on a basic worksheet. I have several numbers which I have to
add additional number to in that cell. I want the cell to reflect the total
and the display of the cell contents to list the individual numbers added.



Rodney POWELL

Follow-Up: adding to a number already in a cell
 
Maybe I misunderstood the question --


Sub AddMore()

Dim EqualSign$

Dim varNumberToAdd As Variant


varNumberToAdd = 3


With Worksheets("MySheet").Range("A1")

If Left$(.Formula, 1) < "=" Then EqualSign$ = "="

.Formula = EqualSign$ & .Formula & "+" & varNumberToAdd

End With

End Sub


Hopefully this is closer to what you were seeking,

- Rodney POWELL
Microsoft MVP - Excel

Beyond Technology
Spring, Texas USA
www.BeyondTechnology.com


"JulieD" wrote in message ...
Hi Rodney

won't this change the value stored in cell A1 rather than "the display of the cell contents to list the individual numbers added" ?

Cheers
JulieD

"Rodney POWELL" wrote in message ...
Conrad -- something like this ...


Sub AddMore()

With Worksheets("MySheet").Range("A1")

.Value = .Value + 1

End With

End Sub


--

Hope it Helps,

- Rodney POWELL
Microsoft MVP - Excel

Beyond Technology
Spring, Texas USA
www.BeyondTechnology.com



"conrad" wrote in message ...
I am working on a basic worksheet. I have several numbers which I have to
add additional number to in that cell. I want the cell to reflect the total
and the display of the cell contents to list the individual numbers added.


Norman Jones

adding to a number already in a cell
 
Oops!

.Formula = "=" & .Formula & "+1"

Should be:

.Formula = .Formula & "+1"


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Rodney,

I think you missed:

display of the cell contents to list the individual numbers added.


Perhaps, change:

.Value = .Value + 1

to:

.Formula = "=" & .Formula & "+1"


---
Regards,
Norman



"Rodney POWELL" wrote in message
...
Conrad -- something like this ...


Sub AddMore()

With Worksheets("MySheet").Range("A1")

.Value = .Value + 1

End With

End Sub


--

Hope it Helps,

- Rodney POWELL
Microsoft MVP - Excel

Beyond Technology
Spring, Texas USA
www.BeyondTechnology.com



"conrad" wrote in message
...
I am working on a basic worksheet. I have several numbers which I have to
add additional number to in that cell. I want the cell to reflect the

total
and the display of the cell contents to list the individual numbers added.





Norman Jones

adding to a number already in a cell
 
Correction!

Sub AddMore()

With ActiveSheet.Range("A1")
If .HasFormula Then
.Formula = .Formula & "+1"
Else
.Formula = "=" & .Formula & "+1"
End If
End With

End Sub

---
Regards,
Norman



"Norman Jones" wrote in message
...
Oops!

.Formula = "=" & .Formula & "+1"

Should be:

.Formula = .Formula & "+1"


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Rodney,

I think you missed:

display of the cell contents to list the individual numbers added.


Perhaps, change:

.Value = .Value + 1

to:

.Formula = "=" & .Formula & "+1"


---
Regards,
Norman



"Rodney POWELL" wrote in message
...
Conrad -- something like this ...


Sub AddMore()

With Worksheets("MySheet").Range("A1")

.Value = .Value + 1

End With

End Sub


--

Hope it Helps,

- Rodney POWELL
Microsoft MVP - Excel

Beyond Technology
Spring, Texas USA
www.BeyondTechnology.com



"conrad" wrote in message
...
I am working on a basic worksheet. I have several numbers which I have

to
add additional number to in that cell. I want the cell to reflect the

total
and the display of the cell contents to list the individual numbers

added.








All times are GMT +1. The time now is 09:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com