Help with adding value (given in userform textbox) to value in worksheet cell

Status
Not open for further replies.

rharri1972

Board Regular
Joined
Nov 12, 2021
Messages
132
Office Version
  1. 2019
Platform
  1. Windows
Hello! I cannot get my mind wrapped around this problem. I have userform 1 with textbox 1 that contains a numerical value that I manually type in.

On the click of a "SUBMIT" command button I want the operation to add this value entered to the value already in my worksheet ("Parts").Range("E2)

If this is possible my goal is this.

on click... let the value in textbox 1 be added to the value in cell E2.

ex: if the value in cell E2 = 15 and the value in textbox 1 = 5... with the click of the button the value in cell E2 updates to 20.

is this possible with VBA?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Your command button code would be similar to the below:
VBA Code:
Private Sub CommandButton1_Click()
    Dim val As Double
    
    val = Sheet1.Range("A1").Value
    Sheet1.Range("A1").Value = val + Me.TextBox1.Value
End Sub
 
Upvote 0
Duplicate to: Updating Cell value in worksheet

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top