VBA to Sort Data in Excel - Excel VBA Tutorial

Поділитися
Вставка
  • Опубліковано 6 вер 2024
  • This example explains simple vba code for data sorting. VBA Macro to sort data in descending order and ascending order with easy example.

КОМЕНТАРІ • 42

  • @ajigrafi
    @ajigrafi 4 роки тому +4

    For anyone who want to run Macro without any button, this the code:
    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    Dim total_data As Range
    Dim specific_column As Range
    Set total_data = Worksheets("Sheet1").Range("A:L")
    Set specific_column = Worksheets("Sheet1").Range("J:J")
    total_data.Sort Key1:=specific_column, Order1:=xlAscending, Header:=xlYes
    Worksheets("Sheet1").Cells(1, 1).Select
    End Sub

  • @itdoeshurt
    @itdoeshurt 5 років тому +2

    3 rascal fiverrrs couldnt do this simple trick for me,
    u saved a life today, thank u and bless u...

  • @derryckklarkowski2269
    @derryckklarkowski2269 3 роки тому +2

    Thank you. I searched many sites with no success. This video gave me the information I needed in a beautifully simple and clear manner. Worked perfectly. Much appreciated!

  • @ralphallengamboa9394
    @ralphallengamboa9394 3 роки тому +1

    Its my first time to know about the Developer Tab, thank you for video Tutorial, you nailed what I came for.

  • @sharadmoktan6874
    @sharadmoktan6874 3 роки тому +2

    What is the VBA code to high light the list box data based on conditions

  • @DeepGill-dl3wj
    @DeepGill-dl3wj 10 місяців тому

    I am getting 'sort method of rante class failed ' error... Kindly advise

  • @1gopalakrishnarao
    @1gopalakrishnarao 5 років тому

    Thank you. Very helpful. Please publish some more for the VBA learners/users/addicts/lovers.

    • @ExcelDestination
      @ExcelDestination  5 років тому +2

      Thanks Gopala for your appreciation...let me know...if you are looking for tutorial on any specific topic in vba...I will try...till then keep watching...and please share it further...

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

    Thanks for this video. I'm subscribing because it is literally perfect.

  • @brightcomputers9326
    @brightcomputers9326 5 років тому +1

    Sir it is a very nice but i am just curious that whether it is implement in automatic process to sort the data? If yes then please give the process

  • @murtadhasafir2053
    @murtadhasafir2053 5 років тому +1

    I would like to know how to sort multiple columns in table format with a single click.

  • @archanaaa2514
    @archanaaa2514 4 роки тому +3

    Sir, how to sort total data at a time ?

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

    How can be sorted when condition is met and toggle between ascending and descending? for example: when a header cell is selected or doble clicked then sort that column in an ascending way by default, but if it is already sorted that way, then sort it in descending way instead

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

    Thanks for this tutorial. Can u pls explain if sort to be oldest to newest then what should be the code?

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

    Thank you so much, it's work perfectly.

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

    I am not a saavy vet when it comes to VBA, this button is not working for me. It simply highlights cell A1,A1 when I click the button. What did I do wrong?

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

      Figured out how it can sort but it's pull my data up that I am attempting to sort. How do I prevent this?

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

      Without looking at code, can not say anything. you can share your code at exceldestination@gmail.com. I will try to check and respond.

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

    Hi. Please suggest. How to enhance this for all the worksheets in the workbook. Please help sir

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

      you can loop through same code for all sheets. you can take help from following tutorial :
      ua-cam.com/video/AlC8a7KyJq0/v-deo.html

  • @alpisuanto6536
    @alpisuanto6536 5 років тому +1

    Thank you for the instructions.

  • @samnangsuonsokunth8719
    @samnangsuonsokunth8719 10 місяців тому

    can you teach me how to find top 10 in vba code?

  • @MOLOKOmilk
    @MOLOKOmilk 5 років тому +1

    Thanks! Very helped me.

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

    How about Sort by Custom ?

  • @arnoldremulta8939
    @arnoldremulta8939 Рік тому +1

    Thank you....

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

    thank you very much for the video!

  • @samnangsuonsokunth8719
    @samnangsuonsokunth8719 10 місяців тому

    can teach me how to find top10?

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

    Thank you sir !

  • @stevennye5075
    @stevennye5075 5 років тому +1

    very useful

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

    Can I used this code with date values??

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

    Great video, thank you so much.

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

    Bundles of Thnx sir.

  • @PremKumar-de6gr
    @PremKumar-de6gr 4 роки тому

    Thank u so much sir

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

    i love you

  • @3ddance367
    @3ddance367 3 роки тому +1

    Thanks
    If 2,2the same

  • @dudeyme3331
    @dudeyme3331 5 років тому +1

    👍

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

    Please reply me

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

      what is your question...have you sent any question on exceldestination@gmail.com ?

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

      I say your comment....please send me your sample data at EXCELDESTINATION@GMAIL.COM, I will call you tomorrow...and will reply to your email also....thanks