How to Sum and update a specific cell that already has a value, with a Userform

michaelroshan

New Member
Joined
Jun 27, 2020
Messages
16
Office Version
  1. 2007
Platform
  1. Windows
I have the following sheet witha Userform. and what i need to do is -
(1). I need the vba code to select a code from the drop down ComboBox. - (I Already figured it out)
(2). once the code is selected, i need to update the specific value of that row in Column "F" according to the code selected from comboBox. by adding to the already existing value. (Example: code "1" has value "250" in F2, and when i enter new value "100" in the TextBox, i need it to be added to the already existing value and show the new value as "350".
Please someone help me with this coding.
Thanks
 

Attachments

  • Untitled22.png
    Untitled22.png
    216.5 KB · Views: 65

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hello Michaelroshan,
Start from this code...

VBA Code:
Dim varComboValue As Range

Private Sub CommandButton1_Click()
    
    Set varComboValue = Range("A1:A10").Find(ComboBox1.Value)
    If Not varComboValue Is Nothing Then
        Cells(varComboValue.Row, 6) = _
        Cells(varComboValue.Row, 6) + UserForm3.TextBox1.Value
    End If
        
End Sub
 
Upvote 0
Hello Michaelroshan,
Start from this code...

VBA Code:
Dim varComboValue As Range

Private Sub CommandButton1_Click()
   
    Set varComboValue = Range("A1:A10").Find(ComboBox1.Value)
    If Not varComboValue Is Nothing Then
        Cells(varComboValue.Row, 6) = _
        Cells(varComboValue.Row, 6) + UserForm3.TextBox1.Value
    End If
       
End Sub
Oh wow!
Many Many Thanks.. it works perfectly..
 
Upvote 0

Forum statistics

Threads
1,223,723
Messages
6,174,115
Members
452,545
Latest member
boybenqn

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