Puzzle: USERFORM AND VBA

Status
Not open for further replies.

Makpo

New Member
Joined
Sep 23, 2011
Messages
28
Hi,

This is like a puzzle for me. I am trying to create a vba code that replaces a value in a cell with an update which will add up the old value to the new value. The cell in question is determined by a VLookUp so we cant tell what it will always be. I am using a userform with a combobox, a textbox and a command button 'add'. Everything else looks fine except this replacement.

This how far I have gone. Can anyone please help point out what am missing?

Code:
Private Sub cmdAdd_Click()

Dim ustock As Integer, pstock As Integer
Dim cboPro As Variant

With Worksheets("Sheet5").Range("TS")
pstock = Application.WorksheetFunction.VLookup(Me.cboPro.Value, Worksheets("Sheet5").Range("TS"), 2, False)
End With

ustock = pstock + Val(txtsto)

'I need to replace the value of pstock on my table with an updated stock value ustock which is an addition of the value from a textbox on this userform

End Sub
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Please stop reposting the same question. I am locking this one.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,224,584
Messages
6,179,693
Members
452,938
Latest member
babeneker

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