+ Reply to Thread
Results 1 to 4 of 4

Macro to sort data range

  1. #1
    Registered User
    Join Date
    03-21-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    15

    Post Macro to sort data range

    Hi folks

    Back again with more excel woes

    I'm carrying out some equine pedigree research. I've attached my sheet as it may make it easier to understand, In cells B3 to B22 I've pasted in some information. This is not split between columns after it was pasted. What I would like to achieve is create a macro to split this information and present parts of it as I have typed in from cells L3 across to cells U3. I just typed in 3 horses there for demonstration purposes to show how I want it to look, but I would like to be able to run something on cells B3:B22 that would present all the horses information from Sea the Stars all the way down to Giants Causeway as such.

    I did attempt to try split the pasted information by using the "text to columns" function but it turned out rather messy and all mixed up,if that had of worked I was intending to just simply record a macro,shortcut ctrl d, to do what I need but then I would run into issues with active and selection cells and the macro would not run correctly. I'm not very experiences running macros to be honest.

    Any help or advice at all would be greatly appreciated

    Thanks
    Steve
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: Macro to sort data range

    Hi there!
    Take a look at the attached file.
    upload.xlsm


    I wanted to take advantage of regular expressions so in order for this code to work you will need to add the
    "Microsoft VBScript Regular Expressions 5.5" reference:
    Pressing Alt+F11 takes you to "Visual Basic for Applications" window. Select "Tools" from the top menu.
    Select "References". Check the box next to "Microsoft VBScript Regular Expressions 5.5" to include in your workbook.
    Click "OK"

    I used the following code:
    Please Login or Register  to view this content.
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

  3. #3
    Registered User
    Join Date
    03-21-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Macro to sort data range

    Hi Bogdan

    That is perfect!! exactly what I wanted!!! and thanks for including the code too so I can see how it was done..

    This will help me immensely going forward!!

    Cheers
    Steve

  4. #4
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: Macro to sort data range

    Steve I'm glad I could help. Thank you for the rep point!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 05-20-2015, 06:21 AM
  2. Replies: 1
    Last Post: 03-04-2015, 02:57 PM
  3. Replies: 1
    Last Post: 09-14-2014, 02:10 PM
  4. [SOLVED] Help with Macro to Sort a Range
    By olives in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 07-10-2013, 12:37 PM
  5. [SOLVED] Macro to select a data range then apply a custom sort
    By dvsbyknight in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-20-2013, 01:50 AM
  6. How to create macro to sort data in dynamic range
    By Luke82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-10-2013, 06:16 PM
  7. Active X (Macro) to Sort data range to included added rows
    By tims31 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-14-2012, 01:21 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1