Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I have a problem that when I play the following macros, it hide everything, and I mean everything and not just the columns a recorded. Sub hide() ' ' hide Macro ' Macro recorded 2004/05/02 by ' ' Keyboard Shortcut: Ctrl+h ' Columns("M:O").Select Selection.EntireColumn.Hidden = True Columns("X:Z").Select Selection.EntireColumn.Hidden = True Columns("AI:AK").Select Selection.EntireColumn.Hidden = True Columns("AT:AV").Select Selection.EntireColumn.Hidden = True Columns("BE:BG").Select Selection.EntireColumn.Hidden = True Columns("BP:BR").Select Selection.EntireColumn.Hidden = True Columns("CA:CC").Select Selection.EntireColumn.Hidden = True Columns("CF:CF").Select Selection.EntireColumn.Hidden = True Columns("CM:CM").Select Selection.EntireColumn.Hidden = True Columns("CR:CR").Select Selection.EntireColumn.Hidden = True End Sub What can I do to make sure it only hides these columns and nothin more. :confused -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
Public Sub Hide() Range("M:O,X:Z,AI:AK,AT:AV,BE:BG,BP:BR,CA:CC,CF:CF ,CM:CM,CR:CR") _ .EntireColumn.Hidden = True End Sub Note that there's almost never a need to select a range - you can use the range object directly In article , sonar wrote: Hi I have a problem that when I play the following macros, it hides everything, and I mean everything and not just the columns as recorded. Sub hide() ' ' hide Macro ' Macro recorded 2004/05/02 by ' ' Keyboard Shortcut: Ctrl+h ' Columns("M:O").Select Selection.EntireColumn.Hidden = True Columns("X:Z").Select Selection.EntireColumn.Hidden = True Columns("AI:AK").Select Selection.EntireColumn.Hidden = True Columns("AT:AV").Select Selection.EntireColumn.Hidden = True Columns("BE:BG").Select Selection.EntireColumn.Hidden = True Columns("BP:BR").Select Selection.EntireColumn.Hidden = True Columns("CA:CC").Select Selection.EntireColumn.Hidden = True Columns("CF:CF").Select Selection.EntireColumn.Hidden = True Columns("CM:CM").Select Selection.EntireColumn.Hidden = True Columns("CR:CR").Select Selection.EntireColumn.Hidden = True End Sub What can I do to make sure it only hides these columns and nothing more. ![]() --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I replaced the one I had with the one you gave and I got a sinte error. Did I do something wrong -- Message posted from http://www.ExcelForum.com |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
J.E.'s code worked for me when I copied from the post to the VBE.
Any chance you introduced extraneous characters (or left some out)? You may want to post what you pasted. "sonar <" wrote: Hi I replaced the one I had with the one you gave and I got a sintex error. Did I do something wrong? --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In article ,
sonar wrote: I replaced the one I had with the one you gave and I got a sintex error. Did I do something wrong? Yes. But I don't know what. Did you include the line extension characters (" _", space-underscore) at the end of the long line? Try copying and pasting. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
How to FIX Recorded Macro | Excel Discussion (Misc queries) | |||
Recorded Macro | New Users to Excel | |||
When i hide columns it hides whole sheet | Excel Discussion (Misc queries) | |||
Button hides unhides columns, how? | Excel Discussion (Misc queries) |