Excel table with columns checkboxes

marcialfa

New Member
Joined
Jan 11, 2017
Messages
12
Hello,

If anyone can help me with this matter I will be very grateful.

d2Hh7m

What I have is a list of columns with checkboxes and I want at the bottom of each column to be a total !


Thank you!

here is a picture of the file
d2Hh7m
https://ibb.co/d2Hh7m
 
Try this:
The range has been changed.
It's easier to not use buttons.

This still works the same with different range.
But now if a mistake is made the user needs to Right click on the cell they want to change and they will get a Message asking if their sure and if they say yes the correction will be made.


If the user installs the script just like you did it should work for them.
Now you should know all users must have macros enable

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column < 33 And Target.Column > 2 And Target.Row > 3 Then
Cancel = True
Dim lastrow As Long
Dim More As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
More = lastrow - 3
If Target.Interior.ColorIndex = 4 Then MsgBox "You have allready answered that question": Exit Sub
    Cells(2, Target.Column).Value = Cells(2, Target.Column).Value + 1
    Cells(3, Target.Column).Value = Cells(2, Target.Column).Value / More
    Target.Interior.ColorIndex = 4
End If
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column < 33 And Target.Column > 2 And Target.Row > 3 Then
Cancel = True
    If Target.Interior.ColorIndex = 4 Then
        ans = MsgBox("Are you sure you want to change", vbYesNo)
            If ans = vbYes Then
                Target.Interior.ColorIndex = xlNone
                Cells(2, Target.Column).Value = Cells(2, Target.Column).Value - 1
                lastrow = Cells(Rows.Count, "A").End(xlUp).Row
                More = lastrow - 3
                Cells(3, Target.Column).Value = Cells(2, Target.Column).Value / More
            End If
    End If
End If
 End Sub
 
Last edited:
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
I see I made one mistake:
Try this: works like I explained in previous post:

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column < 33 And Target.Column > 2 And Target.Row > 3 Then
Cancel = True
Dim lastrow As Long
Dim More As Long
lastrow = Cells(Rows.Count, "C").End(xlUp).Row
More = lastrow - 3
If Target.Interior.ColorIndex = 4 Then MsgBox "You have allready answered that question": Exit Sub
    Cells(2, Target.Column).Value = Cells(2, Target.Column).Value + 1
    Cells(3, Target.Column).Value = Cells(2, Target.Column).Value / More
    Target.Interior.ColorIndex = 4
End If
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column < 33 And Target.Column > 2 And Target.Row > 3 Then
Cancel = True
    If Target.Interior.ColorIndex = 4 Then
        ans = MsgBox("Are you sure you want to change", vbYesNo)
            If ans = vbYes Then
                Target.Interior.ColorIndex = xlNone
                Cells(2, Target.Column).Value = Cells(2, Target.Column).Value - 1
                lastrow = Cells(Rows.Count, "C").End(xlUp).Row
                More = lastrow - 3
                Cells(3, Target.Column).Value = Cells(2, Target.Column).Value / More
            End If
    End If
End If
 End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

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