![]() |
hide one column skip two column and unhide one of 11
Here is what the code you posted does:
Line 1 - Selects entire sheet Line 2 - Unhide all columns Line 3 - Move pointer to cell D5 Line 4 - Move pointer to cell A8 Lines 5 & 6 - Move pointer to right on same row two times Line 7 - Move pointer to cell E9 Line 8 - Hide Column E Line 9 - Move pointer to cell A8 Lines 10 & 11 - Moves pointer to right two times Line 12 - Moves pointer to cell I9 Line 13 - Selects all contiguous cells with data to right of cell I9 Line 14 - Selects cells I thru R on row 9 Line 15 - Hides columns I thru R Line 16 - Moves pointer to cell A8 Line 17 - Ends Sub You could delete lines 3 thru 6, 9 thru 11 and 13 and accomplish the same result, which is to hide column E and Columns I thru r. since I have no idea what your sheet layout is, I can't offer any advice on how to fix your other problem. "Budyza" wrote: I have a report of 14 months data. during a review meeting we use current month plus two previous months. previous previous current hidden hidden hidden hidden NOVEMBER DECEMBER JANUARY FEBRUARY MARCH APRIL ect... DECEMBER Currently I show Nov dec and Jan I created a macro to hide nov and unhide Feb. it works great. when I push the button again it does not go over another column. here is the code I used. it keeps going to the column in the macro no the first open space. HOME is Column A row 8 and is the first row I have a data entry point above that is titles and notes. Cells.Select Selection.EntireColumn.Hidden = False Range("D5").Select Application.Goto Reference:="Home" Selection.End(xlToRight).Select Selection.End(xlToRight).Select Range("E9").Select Selection.EntireColumn.Hidden = True Application.Goto Reference:="Home" Selection.End(xlToRight).Select Selection.End(xlToRight).Select Range("I9").Select Range(Selection, Selection.End(xlToRight)).Select Range("I9:R9").Select Selection.EntireColumn.Hidden = True Application.Goto Reference:="Home" End Sub |
All times are GMT +1. The time now is 11:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com