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

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
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,216,067
Messages
6,128,590
Members
449,461
Latest member
jaxstraww1

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