How to sort table with VBA?

Anonymous
2024-12-20T22:24:25+00:00

Hello, just very interested how to do it , tried everything i knew. Got the next lesson:
Set the name of cell B15 to 'criterion1' and the name of cell B18 to 'new'.
Assign a validation (input check) to the cell named 'criterion1', which allows you to select one birth month from the list.
Write a VBA program that writes from a large table of people (around cell 'tab_alg') to another region (starting at cell 'new')
data of those persons whose birth month and city are specified in the 'criterion1' cell in bold.
The result must have columns: first name, last name, city, month of birth and salary (be sure to in this order).
The program must also output (MsgBox) the number of records (rows) in the resulting result and the arithmetic mean of the salaries of those people.
First, the old results must be deleted (the titles remain).
Also consider the possibility that no records meet the conditions.
The procedure must start when clicking on a graphic object placed on a worksheet and activating this worksheet.
NB! Advanced Filter is NOT used in the VBA program of this application![](https://learn-attachment.microsoft.com/api/attachments/d9d0279f-cebc-4b86-a5ab-60cdabf210d9?platform=QnA

Microsoft 365 and Office | Excel | For education | Other

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
{count} votes

6 answers

Sort by: Most helpful
  1. Anonymous
    2024-12-21T13:56:38+00:00

    Could you share a test file and show an expected result? Then I will have a try on it.

    For sharing file, you may upload it to OneDrive or any other cloud drive and then post the link here.  *Please make sure you have removed any sensitive or private information in the sample file before uploading.

    0 comments No comments
  2. Anonymous
    2024-12-23T06:47:39+00:00

    I cannot understand what you want the macro do. Could you share an expected result?

    Do you want all the data of city cells in bold and another certeria with birthday using macro?

    0 comments No comments
  3. Andreas Killer 144K Reputation points Volunteer Moderator
    2024-12-23T10:20:43+00:00

    Image

    https://www.dropbox.com/scl/fi/vuack6ib9d45ct98n4vv7/c38bd0f9-b497-4f82-ab68-486edf96b003.xlsm?rlkey=ubzu0was2k195dtvqc5zx7e27&dl=1

    This solves the task, but it won't help you if you don't understand the code. You have to do your homework yourself, otherwise the learning effect is zero!

    Andreas.

    0 comments No comments
  4. Anonymous
    2024-12-23T10:53:23+00:00

    I don't think that's the right file Andreas!

    0 comments No comments