Share via

Macro does not sort?

Anonymous
2023-03-24T11:04:32+00:00

On a daily basis I have create an overview of stock in our cold store. For the default tasks I want to do with that data I have created a macro. I always add the way I want the data to be sorted to the macro. For one reason or another, eventually the sorting disappears from the macro. Can I not use a macro for this purpose? I am not familiar with VBA.

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2023-03-28T11:46:46+00:00

I cannot open your link and it need to sign in company id. Could you share your file via private message by clicking the icon below.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Anonymous
    2023-03-27T13:29:06+00:00

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2023-03-27T13:25:34+00:00

    Dear Sirs, thanks for your reply. Sorting was always the last step in the macro. The issue may be the empty rows in the file. Before I upload my data to the excel file I do not know how many lines there will be. This is why there will be empty rows at the end of the file.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2023-03-24T11:32:55+00:00

    Share a test file with dummy data in it. It will help to check your code.

    You can upload to OneDrive, Google Drive or DropBox. Then post a link here.

    You can also paste your macro code here.

    From your description, you should put your sort step at the last of you code.

    Best Reagrds,

    Snow Lu

    Was this answer helpful?

    0 comments No comments
  4. Nikolino 2,120 Reputation points
    2023-03-24T11:27:34+00:00

    You can use a macro to sort your data, but you need to make sure that you record the sorting steps correctly and save the macro after editing it.

    Sometimes the sorting may not work if the data range changes or if there are blank rows or columns in your data.

    You can try to fix these issues by using a dynamic named range or deleting the blank rows or columns.

    You can also check the macro code and see if the sorting criteria are correct.

     One is to make sure that you activate the worksheet that you want to sort before running the macro. 

    Another is to clear any existing sort fields before applying a new sort. 

    A third one is to select the entire range of data that you want to sort instead of just the first row.

    You can try these solutions and see if they work for you.

    I hope this helps.

    Was this answer helpful?

    0 comments No comments