Gregg Wolin
Member
I'm trying to optimize the code I use to navigate within areas of a worksheet based on button clicks. I currently accomplish this with a macro that unhides the columns and rows representing the destination area, then hides the columns & rows outside such destination which is tedious, especially if i move or modify the dimensions of said destination area.
It occurred to me that it might be more efficient to create a named range that represents the cells that comprise the destination area, then to have the macro simply hide all rows and columns that are OUTSIDE of such named range.
For example, if the worksheet range (B2 : R30 ) is named "Destination1," how would i go about hiding all other columns and rows outside the range? Would such a macro run faster than:
It occurred to me that it might be more efficient to create a named range that represents the cells that comprise the destination area, then to have the macro simply hide all rows and columns that are OUTSIDE of such named range.
For example, if the worksheet range (B2 : R30 ) is named "Destination1," how would i go about hiding all other columns and rows outside the range? Would such a macro run faster than:
Code:
Columns("S:XFD").EntireColumnHidden = True
Rows (31:1045879).EntireRows.Hidden = True