Consulting

Results 1 to 3 of 3

Thread: Solved: Userform Event (SOLVED)

  1. #1

    Solved: Userform Event (SOLVED)

    Hi,

    I have following data in Sheet2 in A2:C11

    France Apples 2
    Italy Apples 5
    France Berries 4
    Spain Cherries 1
    Guatemala Bananas 6
    Italy Pears 4
    France Grapes 7
    Italy Grapes 8
    France Pears 8
    Spain Apples 3

    I would like to create a Useform in Sheet2 which has textbox for fruit which counts all the fruit chosen and puts number in cell A1 Sheet1 when the Count command button is pressed in Userform.
    So if I put Apples in textbox then click OK I should get number 10 in Sheet1 cell A1. How do I do that?

    Thanks,
    Nix
    Last edited by Nicolaf; 08-25-2011 at 09:13 AM.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Private Sub TextBox1_AfterUpdate()
    With Worksheets("Sheet2")

    Worksheets("Sheet1").Range("A1").Value = Application.SumIf(.Columns(2), Me.TextBox1.Text, .Columns(3))
    End With
    End Sub[/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Great thanks!
    Nix


Posting Permissions

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