This is because when you select or double-click those cells you're selecting/clicking on 2 cells; you've merged them. So target.value is 2 values, not one, so the If Target.Value=… throws an error.Is there a way to stop it from bringing the debug dialog box up. It seems when you click on A (E6) and the amouont by average (G7) it brings up the debug code box. Run-time error "13" type mismatch.
Thank you, will def have a look into this and adjust it to suit. Appreciated the advice, thanks.This is because when you select or double-click those cells you're selecting/clicking on 2 cells; you've merged them. So target.value is 2 values, not one, so the If Target.Value=… throws an error.
Several ways you can deal with it:
1. Don't merge the cells, instead, unmerge them and in the Format Cells… dialogue box, on the Alignment tab, choose Center Across Selection in the Horizontal alignment dropdown.
2. You can check early on in the code it Target is more than one cell - this is what Vletm has done.
3. You can be very specific about what cells to include/exclude from processing by the macros with the likes of:
If Not Intersect(Target, Range("E9:H108")) Is Nothing Then
or if you have a more complex arrangement of cells then:
If Not Intersect(Target, Range("E9:H108,J9:K24,M9:N24,P9:Q24")) Is Nothing Then
What's more you can combine it with checking for only a single cell with the likes of:
If Not Intersect(Target, Range("E9:H108")) Is Nothing And Target.Count = 1 Then
Cool thank will do so. If I struggle I know where to find youJet Fusion
You asked ... can clear the checkboxes all in one go?
Of course, You can modify code with Your changed needs.
If Target.Value = Chr(254) Then
Jet Fusion
You seems to skipped both hints how to avoid that Your challenge...
Of course, accidents happens ... but You could try to learn from those too.
Please, try to reread both for You given hints and modify Your code.
That way, You could learn ...
What I want to know is, I'm not good at coding, but how would I code it so that for each selcetion (D9) the checkmarks will be for that selction. So when I select number 4 (or whichever) the checkboxes are specific to that number in the (D9) and so on. And also the clear button should also only work for the current selction, not as it is now it will clear for all
but now it gives me a error when selecting more that one (by accident)
What's more you can combine it with checking for only a single cell with the likes of:
If Not Intersect(Target, Range("E9:H108")) Is Nothing And Target.Count = 1 Then
ThanksJet Fusion
If not 'good at coding' ... but You could read ... eg below text:
2. You can check early on in the code it Target is more than one cell - this is what Vletm has done.
You seems skipped that part too.
Please, try to read those hints and compare those code with Your the newest code.
That way, You could learn something.
Many can do copy & paste ( but only few can do that correct way).
What I want to know is, I'm not good at coding, but how would I code it so that for each selcetion (D9) the checkmarks will be for that selction. So when I select number 4 (or whichever) the checkboxes are specific to that number in the (D9) and so on. And also the clear button should also only work for the current selction, not as it is now it will clear for all