VBA Cummulative Summing in a Cell with VLookup

Makpo

New Member
Joined
Sep 23, 2011
Messages
28
Hi,

Please help. Am new with these vba codes. Am working with a table that has two columns. I would like to use vlookup to get the number of a cell in column two by looking up column one and then adding another number to that number. For instance, my combobox (cboPro) has a drop down and I select a value that is in cell A3. I need cell B3 (with a number 13) to increase from 13 to 27 when I type 14 into a textbox (txtQty).

what I find difficult to do is to know exactly how to add a value to the cell via a textbox on a userform.

Here is my code:

Private Sub cmdAdd_Click()
Dim ws As Worksheet
Set ws = Worksheets("ProductInformation")

txtQty.Value = Application.VLookup(cboPro.Value, Range("ProductTable"), 2, 0) + txtQty.Value
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,224,566
Messages
6,179,558
Members
452,928
Latest member
101blockchains

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