FryGirl
Well-known Member
- Joined
- Nov 11, 2008
- Messages
- 1,364
- Office Version
- 365
- 2016
- Platform
- Windows
I'm using a form to capture users input on how many rows/columns show be hidden. Actually, the use with enter on the form the number they want to keep.
The first code below I have for hiding rows, but need it to be variable. It works fine, but not for the columns. Versus using the letter, I need to hide columns by number.
My attempt is below at least for the rows.
The first code below I have for hiding rows, but need it to be variable. It works fine, but not for the columns. Versus using the letter, I need to hide columns by number.
My attempt is below at least for the rows.
Code:
Sub HideRowsCols()
With Sheets("Linest")
.Rows("24:103").EntireRow.Hidden = True
.Columns("8:27").Hidden = True
End With
End Sub
Code:
Sub HideRowsCols()
Dim x As Long: x = 24
Dim xx As Long: xx = 103
With Sheets("Sheet1")
.Rows(" x " & ":" & " xx ").EntireRow.Hidden = True
.Columns("8:27").EntireColumn.Hidden = True
End With
End Sub