ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Textbox question? (https://www.excelbanter.com/excel-discussion-misc-queries/28933-textbox-question.html)

Greg B

Textbox question?
 
I am using a userform to have data transfered to a sheet. I currently use
the code below to send it to a worksheet but what I would like to have
happen is for it to add the total of the textbox to the total already in the
cell.

How do I do that?

Thanks

Greg



Greg B

Here is the code

R = 3 'or whatever desired row variable
Sheets(2).Cells(R, 5).Value = TextBox4.Text
"Greg B" wrote in message
...
I am using a userform to have data transfered to a sheet. I currently use
the code below to send it to a worksheet but what I would like to have
happen is for it to add the total of the textbox to the total already in

the
cell.

How do I do that?

Thanks

Greg





Peter Jausovec

Hi,

You can do it like this:

R = 3 'or whatever desired row variable
dim cellValue as integer
cellValue = Sheets(2).Cells(R, 5).Value
Sheets(2).Cells(R, 5).Value = cellValue + TextBox4.Text

--
http://blog.jausovec.net


"Greg B" je napisal:

Here is the code

R = 3 'or whatever desired row variable
Sheets(2).Cells(R, 5).Value = TextBox4.Text
"Greg B" wrote in message
...
I am using a userform to have data transfered to a sheet. I currently use
the code below to send it to a worksheet but what I would like to have
happen is for it to add the total of the textbox to the total already in

the
cell.

How do I do that?

Thanks

Greg







All times are GMT +1. The time now is 09:19 PM.

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