Clear individual ranges of cells if different individual cells change. I need nested IF changes.

  • Just found out ANOTHER rather strange behaviour for the merged cells... inside an Event macro ... :cursing::evil:


    As you are about to pick a new number ...


    Instead of replacing a given number by another number ...


    - just delete the value ... it will delete the corresponding numbers ...


    - and then ... you can input your new number ... :S:S:S

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • I'm confused, but that is normal.:)

    I am not sure if that Application.EnableEvents has to be at the top of the code you provided, "in" the code or after the code. If that would work.

    I have to run again to go visit with my 90-year-old mother for dinner.

    I really appreciate everything you have done.

    I believe I get what you are talking about with the "picking a new number", thing, but I can live with that, I think...

    I can't believe I have gotten this lost in coding that used to be more comprehensible. Don't get old...

  • Merged Cells do create CONFUSION ... !!!


    An alternative ... may be a bit easier would be to use the Double-Click Event



    P.S. Have a nice dinner with your mother <3

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Carim,


    It still doesn't work. I am assuming that your code was set up so that if I double-clicked in Cell B3, then the values in R3:T5 would clear, either before I actually entered a value in B3 or perhaps After I enter the value.


    I am still a little confused about HOW to use the Application.EnableEvents = True or Application.EnableEvents = False.


    From what I am finding online, it appears the Application.EnableEvents is written inside the VBA event. I have tried it every which way I can.


    I've tried it set to both True and False, and also tried it as True to start and False before the End Sub, and nothing seems to work.


    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

    Application.EnableEvents = True

    If Target.Column > 10 Then Exit Sub

    If Target.Count <> 3 Then Exit Sub

    Dim i As Integer, j As Integer, y As Integer

    i = Target.Row: j = Target.Column

    ' Determine Corresponding Column Number

    y = ((Int(j - 2) * 3) + 18) + (Int(Int(j - 2) / 3))

    ' Contents of Corresponding Range gets cleared '''''''

    Cells(i, y).Resize(3, 3).ClearContents

    Cancel = True

    End Sub


    Also, I am assuming that the VBA code you wrote goes in here:


    Thank you again for ALL your help. You are a life saver! ;)



  • Thanks a lot for your Like :!::!::!::thumbup:


    Good Luck for your Sudoku project ...

    :)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Thank you, Thank you, Thank you...

    Both methods of the code work.

    I was doing a little more testing on the rest of my project when I started typing this.

    I have to admit, I NEVER would have developed a similar way of doing this.

    My coding and use of formulas are NOT nearly as slick as the way the other Soduku works, but it kind of has a different methodology than he had.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!