+ Reply to Thread
Results 1 to 5 of 5

Creating a VBA script to sort a selected group via custom sort.

  1. #1
    Registered User
    Join Date
    09-19-2020
    Location
    Virginia,USA
    MS-Off Ver
    Microsoft Office 365 enterprise
    Posts
    2

    Post Creating a VBA script to sort a selected group via custom sort.

    Hello i am new to the forum world so please bare with me.

    I have been creating Macro's to simplify tasks, my main source of creation has been by recording Macros which has done its far share of help. But I finally have hit a bit of a road block here when trying to record a macro selecting a certain area and then sorting it via the custom sort option under "sort & Filter"... I am sorting with three levels selected.. and am trying to have the Macro create these new levels and run on any new workbook not just a specified work book name which is were my issue comes in, every time I record I get it stated to work with "ActiveWorkbook.Worksheets("sheet1")" which provides an issue as you can imagine because the other work books names are not the same.
    here is the Code i want to run on any workbook i open and run it on. is there an alternative to "Activeworkbook.worksheets("")?

    Please Login or Register  to view this content.


    Thank you !
    Last edited by jpt145; 09-19-2020 at 05:12 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,380

    Re: Creating a VBA script to sort a selected group via custom sort.

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional.)




    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    09-19-2020
    Location
    Virginia,USA
    MS-Off Ver
    Microsoft Office 365 enterprise
    Posts
    2

    Re: Creating a VBA script to sort a selected group via custom sort.

    Thank you for the Welcome TMS!
    Sorry about not noting the Code i have edited it please if you get the chance double check.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,380

    Re: Creating a VBA script to sort a selected group via custom sort.

    Thanks

    Try this:

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Creating a VBA script to sort a selected group via custom sort.

    Or you cn try replacing

    Please Login or Register  to view this content.
    with

    Please Login or Register  to view this content.

+ 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. Creating a custom list to sort by cell color
    By zookeepertx in forum Excel General
    Replies: 4
    Last Post: 11-17-2014, 05:55 PM
  2. Need help in creating a marco/formula/VBA script to sort sales data.
    By Chavis339 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-24-2014, 05:03 PM
  3. Replies: 1
    Last Post: 04-18-2014, 05:54 PM
  4. [SOLVED] I have a sort macro. How to add script to preselect rows to sort based on column value?
    By Jasonhouse in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-09-2014, 02:25 AM
  5. Replies: 2
    Last Post: 07-10-2013, 03:19 PM
  6. Delete empty cells and custom sort by group?
    By iturnrocks in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-17-2008, 03:19 PM
  7. Script to sort selected text
    By diehlkar in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-03-2007, 09:41 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