Results 1 to 4 of 4

Thread: excel sorting row wise with VB Code[RESOLVED]

  1. #1

    Thread Starter
    Lively Member afterMoon's Avatar
    Join Date
    Oct 2002
    Location
    cochin
    Posts
    117

    excel sorting row wise with VB Code[RESOLVED]

    Hi
    My excel worksheet contains data like this

    A B X A U X A U
    11 22 33 44 55 66 77 88
    12 13 14 15 16 17 18 19


    I want to sort the whole data row wise and to be shown as follows

    A A A B U U X X
    11 44 77 22 55 88 33 66
    12 15 18 13 16 19 14 17

    means i have to sort the block of data based on the coloumn header.
    I'm not familiar with the VBA codes so please help me.


    Thanks in advance
    Last edited by afterMoon; Dec 20th, 2004 at 08:02 AM.
    when in doubt, win the trick

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: excel sorting row wise with VB Code

    No VBA needed here. You can use the sort method but column sorted instead
    of the defaullt row sort.

    Step 1. Click Data > Sort... > then click Options... button.




    Step 2. Change the sorting to "Sort left to right."




    Step 3. Change the Sort By to "Row 1".




    Done!
    Code:
    Results:
    A	A	A	B	U	U	X	X
    11	44	77	22	55	88	33	66
    12	15	18	13	16	19	14	17
    HTH
    Attached Images Attached Images    
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Lively Member afterMoon's Avatar
    Join Date
    Oct 2002
    Location
    cochin
    Posts
    117

    Resolved Re: excel sorting row wise with VB Code

    Thank you very much Mr.Rob. You saved my time!.
    Thanks again

    -afterMoon-
    when in doubt, win the trick

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: excel sorting row wise with VB Code[RESOLVED]

    No prob. Glad to help.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

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



Click Here to Expand Forum to Full Width