Generating a checkbox corresponding to the each worksheet on click
Hi,
I have written the code below, which hopefully will search through all checkboxes on a page, and ensure that there is a checkbox corresponding to each worksheet, if there is not one for a certain page, I want it to add one in. The checkboxes are form control checkboxes (not ActiveX), they are all in one vertical column and I am looking for it to add one directly below if it is not already found in the search. However, I am stuck, as I don't know how to find the location of the 'lowest' checkbox and from there add another one below (with even spacing). Any help is appreciate, thanks and Here is my code:
Code:
Private Sub Update_Click()
Dim LowestCheck As CheckBox
Dim cb As CheckBox
Dim Exists As Boolean
For Each ws In ActiveWorkbook.Worksheets
For Each cb In ActiveSheet.CheckBoxes
If cb.Name = ws.Name Then
Exists = True
End If
Next
If Exists = False Then
*FINDS LOWEST CHECKBOX AND ADDS IN CHECKBOX BELOW WITH*
Next
End Sub