Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.73 KB | None | 0 0
  1. Private Sub GetOrdersBtn_Click()
  2. Dim result As String, email As String, product As String, totalPrice As Double, lastRow As Integer, i As Integer
  3. email = EmailCB.Value
  4. lastRow = Sheet1.Cells(Rows.Count, 2).End(xlUp).row
  5. ResultTB.Clear
  6. For i = 2 To lastRow
  7. If Sheet1.Cells(i, "A").Value = email Then
  8. product = Sheet1.Cells(i, "B").Value
  9. totalPrice = Sheet1.Cells(i, "E").Value
  10. result = product & " - " & Format(totalPrice, "0.00")
  11. ResultTB.AddItem (result)
  12. End If
  13. Next
  14.  
  15. End Sub
  16.  
  17. Private Sub UserForm_Initialize()
  18. Dim lastRow As Integer, i As Integer
  19. lastRow = Sheet1.Cells(Rows.Count, 1).End(xlUp).row
  20. For i = 2 To lastRow
  21.   If EmailCB.MatchFound = False Then
  22.    EmailCB.AddItem (Sheet1.Cells(i, "A"))
  23.   End If
  24. Next
  25.  
  26.  
  27.  
  28. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement