I picked up some code from here the other day which toggles hide / show columns. My problem is that there are some columns which are hidden before further columns are hidden and then when the columns are unhidden, all of them are unhidden. When the columns are unhidden I want some to remain hidden. I have tried the following, unsuccessfully

Private Sub CommandButton1_Click()

    Range("M:U,X:AH").EntireColumn.Hidden = Not Range("M:U,X:AH").EntireColumn.Hidden
    Range("Y:Y,AB:AB,AE:AE").EntireColumn.Hidden = Not Range("Y:Y,AB:AB,AE:AE").EntireColumn.Hidden

End Sub
The first line hides and shows all the columns correctly, I then want the button to hide the columns in the second line.

Any ideas, please.