VBA - Sort by checked checkboxes and print

Jasesair

Active Member
Joined
Apr 8, 2015
Messages
282
Office Version
  1. 2016
I have data in range A6:K203. Column K contains checkboxes. My end result is wanting a printpreview of the range but only to show rows where column K contains checked checkboxes..

My thinking was to sort by column K somehow and then print the range down to the last row that's checked. Does anyone know how to do this? Or perhaps there's a better method???
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
One option ...
- link the checkboxes to a cell in the same row in a new (possibly hidden) column in your data and then filter on that
 
Upvote 0
I have this happening actually. The full range (to include the links) is A6:P203. Headings are in row 5. The checkboxes linked to Column K are in Column M, which are hidden. My attempts so far to sort have thrown the checking in the checkboxes all out. Any help with this would be much appreciated.
 
Upvote 0
Perhaps ...

Checkbox1.jpg
 
Upvote 0
Apologies. I mean that my attempts at sorting with VBA have failed. The correct checked checkboxes shift and aren't attached to the correct people etc in the other columns within the range. I'm a bit new to VBA and so I'm still learning on-the-fly.
 
Upvote 0
In my testing "move but don't size with cells" results in checkboxes piling on top of other checkboxes when rows are hidden.

In situation where rows will be hidden or filtered, I prefer turning cells into Marlett checkboxes rather than using inserted controls.
Putting this code in the sheet's code module and double clicking on a cell in coulmn K will make each cell act as a checkbox.

VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    With Target
        If .Column = 11 Then
            Cancel = True
            If .Value = "a" Then
                .Value = vbNullString
            Else
                .Value = "a"
                .Font.Name = "Marlett"
            End If
        End If
    End With
End Sub
 
Upvote 0
I'd prefer to keep the checkboxes as is (one click to check and uncheck). I'm just wanting a way to do a print of the range where column M is True.
 
Upvote 0
Would you have macro for this? My attempts failed miserably. I had tried sorting.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top