Updating Cell value in worksheet

rharri1972

Board Regular
Joined
Nov 12, 2021
Messages
132
Office Version
  1. 2019
Platform
  1. Windows
what would the code be if I have a value in cell "A1" and I want to, with the click of a button on a userform, have range A1 value = a certain textbox value from the userform be added to the value in A1 on the worksheet to update value.

Example: current value of A1 is 11
Text box on userform will have a value of 4
On click of button i want the 4 to be added to the 11 in cell A1 to update to 15.

Worksheet = "Inventory"
userform=userform1

Thank you for ANY help!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
One way.
VBA Code:
Private Sub CommandButton1_Click()
    With Worksheets("Inventory").Range("A1")
        .Value = .Value + Val(Me.TextBox1.Value)
    End With
End Sub
 
Upvote 0
One way.
VBA Code:
Private Sub CommandButton1_Click()
    With Worksheets("Inventory").Range("A1")
        .Value = .Value + Val(Me.TextBox1.Value)
    End With
End Sub
Thanks rlv01... works great!!
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,688
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