Forms Checkboxes

I'am trying to sort Checkbox but can't manage to do it using VBA.

What I have done so far is the following:

- Add checkboxes using VBA to span a cell [CODE] ActiveSheet.CheckBoxes.Add(MyLeft, MyTop, MyWidth, MyHeight).Select
- Select a range in a sheet and by using Sort and Filter button - Custom sort then default options ( A column - By value - From A to Z)
- A Macro has been set for each checkbox

This way the column in which I have the Checkboxes are sorted correctly.

My problem is that using VBA to sort the range using Macro Recorder does not sort my checkboxes.

Someone has an idea ?

The goal is to take several tables, merge then sort them.

AttachmentSize
Checkboxes.xlsm25.71 KB

I finally find the problem.

I finally find the problem. It was due to the row size which I needed to change because of the checkboxes at border of the cells.

No problem to sort with Excel but problem with VBA. After resizing the row, no more problem.

Thank you for your comments anyway.

Checkbox sort problem

Hi,

I tried your example file and there is no problem - all controls was sorted. In your code, please pay attention to this part (bolded line):

With ActiveWorkbook.Worksheets("Sheet1").Sort
        .SetRange Range("A2:H11")
        ...
End With

When you megre data from several tables, this range is changed, and if you forget to change it into the macro, the results will not be as you expect. If this is not your case, please can you explain in more details what exactly you do and when the problem rise.

 

Best regards.