+ Reply to Thread
Results 1 to 6 of 6

Sorting by column issues with expanded selection

  1. #1
    Registered User
    Join Date
    02-17-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2010
    Posts
    6

    Unhappy Sorting by column issues with expanded selection

    Hi, first time on here and also first time working on vba's and have become stuck on what is such an infuriating issue

    I have a workbook with multiple worksheets for creating team rota's from a master .csv file. The steps are:

    1) a manager can pastes the csv file onto one sheet
    2) the manager then enters the start date of the week into a field on the main control sheet and hits the run button added.
    3) this is then copied by a macro to another sheet so that the vlookup's can pick up the data and sort it into team members
    4) a new sheet is created and the values/formatting is copied onto it from step 3
    5) the new sheet is renamed to the date entered on step 2 and opens so that it can be viewed and printed.

    The problem I have is that on step 3 I can get the information to copy over but I can't get it to sort it alphabetically by column b with an expanded selection.

    The worksheet to sort is called "Data" if you need to know.

    I have set the rest of the steps up using borrowed code or recording macro's so getting really stuck.

    Any help will be appreciated.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Sorting by column issues with expanded selection

    Hi, Abuba3000,

    maybe
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    could be of help instead of the code you wonīt show (I assume either Selection or a given range). Please mind that the latter command could run into problems if ranges have been deleted and the workbook hasnīt been saved.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    02-17-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Sorting by column issues with expanded selection

    Sorry, I meant to include the code I have so far:

    Please Login or Register  to view this content.
    Can I just add one of your examples HeHoBe?

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Sorting by column issues with expanded selection

    Hi, Abuba3000,

    please try
    Please Login or Register  to view this content.
    CurrentRegion will expand from the starting cell (here A1) until either an empty row or column will end the range.

    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    02-17-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Sorting by column issues with expanded selection

    Thank you Holgar, however the data source has a few empty rows in the middle which will stop it. Can you advise how I can amend it to define the range?

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Sorting by column issues with expanded selection

    Hi, Abuba3000,

    maybe like this:
    Please Login or Register  to view this content.
    Ciao,
    Holger

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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