ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Help with Make Visible Rows (https://www.excelbanter.com/excel-programming/384525-vba-help-make-visible-rows.html)

[email protected]

VBA Help with Make Visible Rows
 
Hello, all.
I am building a quick spreadsheet tool in MS Excel 2000. I have a
predefined range of 100x100 cells, of which the the top left 25x25
needs to be initially visible. What I'd like to do is have a cell
available for user input to key in the necessary number of cells
needed to be visible. The smallest range will always be 25x25. So
any user entry of value 1-25 will result in the minimum 25x25 range,
but a value of 26 will make visible 1 extra row and column.

Is this possible in VBA? I've never been good at the programming
thing, and any help would be greatly appreciated!


Bernie Deitrick

VBA Help with Make Visible Rows
 
With the block size entered in cell A1:


Sub MakeBlockVisible()
Dim AreaSize As Integer

AreaSize = Application.Min(255, Application.Max(25, Range("A1").Value))
Cells.EntireColumn.Hidden = False
Cells.EntireRow.Hidden = False

Rows(AreaSize + 1 & ":" & Rows.Count).EntireRow.Hidden = True
Range(Columns(AreaSize + 1), Columns(Columns.Count)).EntireColumn.Hidden = True

End Sub


HTH,
Bernie
MS Excel MVP


wrote in message ups.com...
Hello, all.
I am building a quick spreadsheet tool in MS Excel 2000. I have a
predefined range of 100x100 cells, of which the the top left 25x25
needs to be initially visible. What I'd like to do is have a cell
available for user input to key in the necessary number of cells
needed to be visible. The smallest range will always be 25x25. So
any user entry of value 1-25 will result in the minimum 25x25 range,
but a value of 26 will make visible 1 extra row and column.

Is this possible in VBA? I've never been good at the programming
thing, and any help would be greatly appreciated!





All times are GMT +1. The time now is 09:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com