Consulting

Results 1 to 3 of 3

Thread: VBA - Determine cell value of specific column and row in userform

  1. #1

    VBA - Determine cell value of specific column and row in userform

    Please refer to this attachment ProgramTemplate.xlsm.

    I have a userform where you can pick a Customer from a drop down list and also a product from a drop down list.
    Depending on the customer and product chosen, a Discount must be applied.

    That specific discount is located on sheet "Customers" in a table whose rows are the Customers and columns are the Products.

    Once I have chosen the customer and the product, how can I extract the discount matching my selection?

    Please refer to the attached excel file and fill in the code in the section indicated.
    Thank you all

  2. #2
    VBAX Regular HaHoBe's Avatar
    Joined
    Aug 2004
    Location
    Hamburg
    Posts
    89
    Location
    Hi, tarekgemayel,

    try it like this:
    Private Sub ProductBox_Change()
    On Error GoTo Error_Error
    
    'Update Discount depending on selected Customer and Selected Product
    '''''INSERT CODE HERE
       DiscountBox.Text = Worksheets("customers").Cells(CustomerBox.ListIndex + 2, ProductBox.ListIndex + 2).Value
    ''''END OF CODE HERE
    On Error GoTo 0
       Exit Sub
    
    Error_Error:
    MsgBox "Error when updating Discount"
    
    End Sub
    Ciao,
    Holger

  3. #3
    ahhhhhh. So there is in fact a Property that serves this purpose. lol
    Finally

    Thanks a lot buddy.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •