Home » excel » excel – Hiding multiple columns on another sheet: Type mismatch

excel – Hiding multiple columns on another sheet: Type mismatch

Posted by: admin May 14, 2020 Leave a comment

Questions:

got hugely stuck on what seemed a simple task… get type mismatch error when I try to hide multiple columns using this code..

any better suggestions?

Regards,

Sub Hider()

        Sheets("Data Source").Columns("O:AK").Hidden = False

        Sheets("Data Source").Columns("W, V").Hidden = True

    end sub
How to&Answers:

Give it a try:

Sub Hider()

    Sheets("Data Source").Columns("O:AK").Hidden = False

    Sheets("Data Source").Range("W:W, V:V").EntireColumn.Hidden = True

end sub

Answer:

Use

Sheets("Data Source").Columns("V:W").Hidden = True

instead of

Sheets("Data Source").Columns("W, V").Hidden = True