![]() |
Hide Cols ??
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 |
Hide Cols ??
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 |
Hide Cols ??
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 |
Hide Cols ??
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 |
All times are GMT +1. The time now is 11:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com