Multi-level To-Do list template
Today I will share a To-do list excel template with you. You can add text to the sheet and an Excel macro creates corresponding checkboxes instantly. Press with left mouse button on a checkbox and the related text is marked as finished. Also, the corresponding checkbox is automatically removed if you delete text.
What's on this page
Multi-level To-Do list
The animated image below demonstrates how to create new items and mark items finished.
How to add checkboxes?
Type in any cell and a checkbox is instantly and automatically created on the adjacent cell to the left. Checkboxes are not created if multiple cells are simultaneously entered at the same time.
How can I enter multiple cells simultaneously?
- Select a cell range. Type the text. Press CTRL + Enter. All selected cells are now populated.
- Copy a cell. Paste to a cell range. All cells in the cell range now contain the contents of the copied cell.
An event macro is what it takes to make this possible. They are stored in a worksheet module contrary to a regular macro that is stored ina regular module.
How to remove checkboxes?
Simply select a cell containing text and press the "Delete" key. The corresponding checkbox is deleted by a macro.
You can also manually delete checkboxes, here is how. Press and hold CTRL-key. Press with left mouse button on with the left mouse button on the checkbox you want to delete. Press the "Delete" key.
The macro below that lets you delete all checkboxes on a worksheet.
Sub RemoveCheckboxes() ActiveSheet.CheckBoxes.Delete End Sub
How to run a macro?
Run macro RemoveCheckboxes if you want to delete all checkboxes on a worksheet.
- Press shortcut keys Alt + F8 to open the Macro dialog box.
- Press with mouse on the macro name to select it.
- Press with left mouse button on the "Run" button.
The list in the "Macro" dialog box shows all available macros, if RemoveCheckboxes is not there you need to first save it to a module. Instructions below.
Event code
'Event code that runs when a cell has a new value Private Sub Worksheet_Change(ByVal Target As Range) 'Disable screen refresh Application.ScreenUpdating = False 'Dimension variable and declare data types Dim cell As Range 'Check if changed cell's row is 2 If Target.Row = 2 Then Exit Sub 'Check if more than one cell has been changed If Target.Cells.Count > 1 Then 'Iterate through each changed cell For Each cell In Target 'Run macro named AddRemoveChkbx with parameter cell Call AddRemoveChkbx(cell) 'Continue with next cell Next cell 'Go from here if only one cell has been changed Else 'Save target cell to object named cell Set cell = Target 'Run macro AddRemoveChkbx with parameter cell Call AddRemoveChkbx(cell) End If 'Enable screen refresh Application.ScreenUpdating = True End Sub
Where to put the Event code?
Event code is stored in the worksheet or workbook module, in this case, the worksheet module.
- To access the worksheet module press with right mouse button on on a worksheet tab.
- A pop-up menu appears, press with left mouse button on "View Code". See the image above.
- The Visual Basic Editor opens and the worksheet module is displayed.
- Paste the code to the worksheet module.
VBA Macros
'Name macro Sub Press with left mouse button onChkbx() 'Iterate from 1 to the number of rows in your worksheet For r = 1 To Rows.Count 'The With ... End With statement allows you to write shorter code by referring to an object only once instead of using it with each property. With ActiveSheet.Shapes.Range(Array(Application.Caller)) 'Check if cell's top value is equal to the press with left mouse button oned check box, based on variable r If Cells(r, 1).Top = .Top Then 'Iterate from 1 to the number of columns in your worksheet For c = 1 To Columns.Count 'Check if cell's left value is equal to checkbox's left value + 24 If Cells(r, c).Left = .Left + 24 Then 'The With ... End With statement allows you to write shorter code by referring to an object only once instead of using it with each property. With Cells(r, c).Font 'Apply strikethrough to text based on variables r and c .Strikethrough = Not .Strikethrough End With 'Stop For ... Next statement Exit For End If Next c 'Stop For ... Next statement Exit For End If End With Next r End Sub
'Name macro, dimension parameteres and declare data types Sub AddRemoveChkbx(cell As Range) 'Dimension variables and declare data types Dim CLeft As Double, CTop As Double, CHeight As Double, CWidth As Double Dim chkbx As CheckBox 'Check if cell value is not equal to nothing If cell.Value <> "" Then 'The With ... End With statement allows you to write shorter code by referring to an object only once instead of using it with each property. With cell.Offset(0, -1) 'Add half of width of a cell to the left property value and save to variable CLeft CLeft = Cells(.Row, .Column).Left + Cells(.Row, .Column).Width / 2 'Save top property value to variable CTop CTop = Cells(.Row, .Column).Top 'Save Height property value to variable CHeight CHeight = Cells(.Row, .Column).Height 'Save width property value divided by 2 to variable CWidth CWidth = Cells(.Row, .Column).Width / 2 End With 'Create checkbox based on variables CLeft, CTop, CWidth, CHeight ActiveSheet.CheckBoxes.Add(CLeft, CTop, CWidth, CHeight).Select 'The With ... End With statement allows you to write shorter code by referring to an object only once instead of using it with each property. With Selection 'Assign macro Press with left mouse button onChkbx to checkbox .OnAction = "Press with left mouse button onChkbx" 'No caption .Caption = "" 'Unchecked checkbox .Value = xlOff 'No 3D shading .Display3DShading = False End With 'Select cell below cell.Offset(1, 0).Select 'If cell has value continue here Else 'Iterate through all checkboxes on active worksheet For Each chkbx In ActiveSheet.CheckBoxes 'Check If cell's top value matches checkboc top value If cell.Top = chkbx.Top Then 'Remove checkbox from worksheet chkbx.Delete 'Remove strikethrough from cell cell.Font.Strikethrough = False End If Next 'Select cell below cell.Offset(1, 0).Select End If End Sub
Where to put the macros?
- Press shortcut keys Alt+ F11 to open the Visual Basic Editor.
- Press with left mouse button on "Insert" on the top menu, see image above.
- Press with left mouse button on "Module" to create a new module in your workbook.
- Copy above VBA code.
- Paste VBA code to code window, see blue arrow in the image above.
Bonus tip - Quickly insert checkboxes
You can quickly insert many checkboxes without inserting them one by one.
- Go to Developer tab on the ribbon
- Press with left mouse button on "Insert" button on the ribbon
- Place a checkbox on a cell
- Select the cell
- Press and hold on black dot on lower right corner
- Drag down
- Release button
You don't need to do this with the attached file, the VBA code inserts a checkbox automatically as soon as you type in a cell.
Recommende reading
The Best To Do List Templates in Excel
Excel To Do List Template – 4 Examples
Check boxes category
Table of Contents Add Checkboxes to a Worksheet Copy selected rows based on check boxes Worksheet data VBA code Where […]
Templates category
Table of Contents Monthly calendar template Monthly calendar template 2 Calendar - monthly view - Excel 365 Calendar - monthly […]
In this article, I am going to demonstrate a simple workbook where you can create or delete projects and add […]
This article demonstrates how to highlight given date ranges in a yearly calendar, this calendar allows you to change the […]
Excel categories
7 Responses to “Multi-level To-Do list template”
Leave a Reply
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form
Hi Oscar. This is interesting. I have opened the To-Do List Template.xlsm and after extraction is giving all xml files. can you please let me know how to add this to excel and how to use this.
Kiran,
Your computer opens the attached file with win zip when it should be excel. Don´t ask me why.
Read here:
https://www.makeuseof.com/answers/internet-explorer-save-docx-xlsx-zip-files/
Very nice work
Thank you for your teaching me
Is there anything on the multi-level to do index file with tracking option of start date, target date, across various function (say of Sales, Finance, Purchase, Production, etc.), a remark column, highlighting option (in case of deviation), person handling, projectwise, categorywise, in accordance with importance.
Please help.
Bharat,
Can you exlpain in greater detail? Perhaps upload an excel file?
If you are interested in learning Multiple Level Sorting Using VBA
https://www.exceltip.com/tips/multiple-level-sorting-using-vbain-microsoft-excel-2010.html
hi oscar,
i am struggling with one problem in excel can u help me out ?
my excel sheet contains
column A column B column c column d
344.01 spe mer 1
344 TEF mer 2
56.09 reg ser 3
56 let ter 1
67.09 dot mer 2
890 mtu ter 3
and so on like this.....
Now my objective is to get the count where column b can be (spe or tef) and column C can be mer and column d can (be 1 or 2)
i need a formula in macros