• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Problem Hiding Columns...

aklewe

New Member
Why it is the seemingly simple tasks can give us the most trouble? I want to run a simple bit of code to hide columns E:M like so...


Columns("E:M").Select

Range("E3").Activate

Selection.EntireColumn.Hidden = True


HOWEVER, when I run the above macro, it hides all columns A:M... does anyone have a clue why this may be happening? The above is the only code in the macro currently.


Thanks!


aklewe

*happy excel geek*
 
Good day aklewe


If you record a macro while doing as you want it records as per your code but without the Range(“E3”).Activate


Sub Macro1()

Columns("E:M").Select

Selection.EntireColumn.Hidden = True

End Sub


Columns("E:M").Select

Range("E3").Activate

Selection.EntireColumn.Hidden = True
 
Thanks for the help. If I remove 'Range("E3").Activate', I still get the same result when I run the macro...it hides columns A:D as well as E:M. I really am puzzled.


aklewe

*happy excel geek*
 
Narayan - you are genius! I knew it had to be something on my spreadsheet itself causing the problem. I unmerged the cells I had across those columns, and now the code works just fine.


THANKS ALL!


aklewe

*happy excel geek*
 
Back
Top