Excel VBA Calculations in a Userform

Поділитися
Вставка
  • Опубліковано 7 січ 2025

КОМЕНТАРІ • 26

  • @WaresHadi
    @WaresHadi Рік тому

    Thanks for uploading the video. Sir, as we are using "txt" as a predecessor for Textbox. In a similar way, we may use "cmb" as a predecessor for ComboBox instead of "cmd". Best regards.

  • @lordsalisbury1
    @lordsalisbury1 8 років тому

    Great video bro, seriously, thanks.

  • @mickaelacanites8382
    @mickaelacanites8382 4 роки тому

    how did you do the "click the userform"?

  • @newstudent3397
    @newstudent3397 2 роки тому

    great stuff. I am trying to adapt code to different set of data with not a lot of progress. Why do you use "Me." before each data element...such as "Me.txtresults.value"

  • @jonnathanjon1
    @jonnathanjon1 Рік тому

    Are you from nsw?

  • @commoditycontrolserviceslt6655
    @commoditycontrolserviceslt6655 7 місяців тому

    Sir, Thank you very much. I found your site is down. It'll be great If I get this file or code. Plz

    • @commoditycontrolserviceslt6655
      @commoditycontrolserviceslt6655 7 місяців тому

      I've made this. If anyone needs it, Just knock me. Thanks. Code below:
      Option Explicit
      Private Sub cmdAdd_click()
      Dim nextrow As Range
      'check for values
      If Me.cmdProducts.Value = "" Or Me.txtQuantity.Value = "" Then
      MsgBox "Please add the porduct quantity"
      Exit Sub
      End If
      'find the next blank row
      Set nextrow = Sheet1.Cells(Rows.Count, 2).End(xlUp).Offset(1, 0)
      'send the data to the database
      With nextrow
      .Value = Me.cmdProducts.Value
      .Offset(0, 1).Value = Me.txtQuantity.Value
      .Offset(0, 2).Value = Me.txtKg.Value
      .Offset(0, 3).Value = Me.txtPercent.Value
      .Offset(0, 4).Value = Me.txtMarkup.Value
      .Offset(0, 5).Value = Me.txtTotal.Value
      End With
      'update the worksheet
      Application.ScreenUpdating = True
      'clear the values
      With Me
      .cmdProducts.Value = ""
      .txtQuantity.Value = ""
      .txtKg.Value = ""
      .txtPercent.Value = ""
      .txtMarkup.Value = ""
      .txtTotal.Value = ""
      End With
      'give the user the thumbs up
      MsgBox "The data has been sent to the database"
      End Sub
      Private Sub cmdClose_click()
      'close the userform
      Unload Me
      End Sub
      Private Sub cmdProducts_Change()
      'clear the value if the products change
      With Me
      .txtQuantity.Value = ""
      .txtKg.Value = ""
      .txtPercent.Value = ""
      .txtMarkup.Value = ""
      .txtTotal.Value = ""
      End With
      End Sub
      Private Sub txtQuantity_AfterUpdate()
      'check fo values and datatype
      If Not IsNumeric(Me.txtQuantity.Value) Or Me.cmdProducts = "" Then
      MsgBox "Number Input Only"
      Me.txtQuantity.Value = ""
      Exit Sub
      End If
      'send the values to the worksheet
      With Sheet1
      .Range("M5").Value = Me.cmdProducts.Value
      .Range("N5").Value = Me.txtQuantity.Value
      End With
      'retrieve the results
      With Me
      .txtKg.Value = Sheet1.Range("O5").Value
      .txtKg.Value = Format(Me.txtKg.Value, "$#,##0.00")
      .txtPercent.Value = Sheet1.Range("P5").Value
      .txtPercent.Value = Format(Val(Me.txtPercent.Value) * 100, "0:00%")
      .txtMarkup.Value = Sheet1.Range("Q5").Value
      .txtMarkup.Value = Format(Me.txtMarkup.Value, "$#,##0.00")
      .txtTotal.Value = Sheet1.Range("R5").Value
      .txtTotal.Value = Format(Me.txtTotal.Value, "$#,##0.00")
      End With
      End Sub
      Private Sub UserForm_Click()
      End Sub

  • @akabanekarma3246
    @akabanekarma3246 7 років тому

    Please help, I have a problem while running the code. The cost per Kg and the markup won't show :/

  • @saeedalikhan7128
    @saeedalikhan7128 8 років тому

    thanks sir

  • @tekd6251
    @tekd6251 9 років тому

    How to do if the userform and data entered is in different sheet.

    • @harithabdullah5833
      @harithabdullah5833 3 роки тому

      use the macros and name range. i just learnt it from his other videos :D

  • @dbasannar
    @dbasannar 7 місяців тому

    If the complete code needs to be shown

  • @nammarcr33737
    @nammarcr33737 5 років тому

    Dear sir will you create a video for
    Billing userform with calculation in vba userform
    USERFORM
    Products|Qty|Weight|Rate|Amount|
    Steelrod || 10 ||103| 45perkG||4635
    After this database transfer in excel sheet

  • @unitedworldcare9497
    @unitedworldcare9497 4 роки тому

    Thank you Sir

  • @mikeymirabelli
    @mikeymirabelli 7 років тому

    Hello, can you send me this xlsm file?

    • @mikeymirabelli
      @mikeymirabelli 7 років тому

      mikemirabelli6@hotmail.com

    • @ahmetyigit6251
      @ahmetyigit6251 4 роки тому +1

      @@mikeymirabelli Hi did u get this file? Could u please share with me? Thank u very much

    • @commoditycontrolserviceslt6655
      @commoditycontrolserviceslt6655 7 місяців тому

      @@ahmetyigit6251 Hi, If you get plz send me also. plz plz and thanks.

  • @balasaravanan5174
    @balasaravanan5174 9 років тому

    hello sir., i have one doubt. pls clear it
    in excel vba form. There are three check box button if first button is checked then the value of cell is multiply by one, if second button is checked then the value of cell is multiply by two, if third button is checked then the value of cell is multiply by three. What is the code. pls clear

  • @niphaphatr1
    @niphaphatr1 5 років тому

    Thangk you so much

    • @ahmetyigit6251
      @ahmetyigit6251 4 роки тому

      Hii if u do this file or have, could u please share with me ?

  • @bassisessaidexcel
    @bassisessaidexcel 5 років тому

    Merci

  • @AlanJxcob
    @AlanJxcob 8 років тому

    Hi i need help in my VBA, is it possible if i could send you my codes? Thanks

  • @dbasannar
    @dbasannar 7 місяців тому

    youtube audio quality is poor