Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, Using the recorder I got the following macro to try to hide cols G to L. Columns("G:L").Select Selection.EntireColumn.Hidden = True When I run the macro it hides from col B to col M inclusive. I have tried unmerging any cells in these cols that overlap with the range I want to hide etc but it makes no difference. How do I get a code to hide the cols i wish? Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() looks ok to me Columns("G:L").EntireColumn.Hidden = True in Excel 2003 and 2007 ONLY these columns get hidden. "LiAD" wrote in message ... Hi, Using the recorder I got the following macro to try to hide cols G to L. Columns("G:L").Select Selection.EntireColumn.Hidden = True When I run the macro it hides from col B to col M inclusive. I have tried unmerging any cells in these cols that overlap with the range I want to hide etc but it makes no difference. How do I get a code to hide the cols i wish? Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I bet you have merged cells that span B:M (including G:L). If you remove those merged cells, then your code will work ok. LiAD wrote: Hi, Using the recorder I got the following macro to try to hide cols G to L. Columns("G:L").Select Selection.EntireColumn.Hidden = True When I run the macro it hides from col B to col M inclusive. I have tried unmerging any cells in these cols that overlap with the range I want to hide etc but it makes no difference. How do I get a code to hide the cols i wish? Thanks -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Here's a routine you can use to locate merged cells. It shades the cells a certain color. You could also change the border or do something else instead... HTH, Eric ' ' Finds and marks all merged cells in the used range ' of a worksheet. ' Sub MarkMergedCells() Dim rsel As Range, r As Range ' Set rsel = Nothing For Each r In ActiveSheet.UsedRange If r.MergeCells = True Then If rsel Is Nothing Then Set rsel = r Else Set rsel = Union(rsel, r) End If End If Next If rsel Is Nothing Then Else rsel.Interior.ColorIndex = 3 End If End Sub "LiAD" wrote: Hi, Using the recorder I got the following macro to try to hide cols G to L. Columns("G:L").Select Selection.EntireColumn.Hidden = True When I run the macro it hides from col B to col M inclusive. I have tried unmerging any cells in these cols that overlap with the range I want to hide etc but it makes no difference. How do I get a code to hide the cols i wish? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Enhance sub to copy cols of variable length into 1 col to snake results into other cols | Excel Programming | |||
2 Cols To 2 Cols VLookup Comparison | Excel Discussion (Misc queries) | |||
Range.Select 1st pass 13 cols, 2nd paqss 25 cols twice as wide in error? | Excel Programming | |||
Cond Format:re color 2 cols, skip 2 cols | Excel Worksheet Functions | |||
Hide Unused Cols & Rows in a Range | Excel Programming |