ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hiding/Unhiding sheets and rows (An easy one for most of you....) (https://www.excelbanter.com/excel-programming/323971-hiding-unhiding-sheets-rows-easy-one-most-you.html)

Dean Goodmen

Hiding/Unhiding sheets and rows (An easy one for most of you....)
 
That works great; however how would you hide multiple rows, or a range
of them?

I tried Rows("2:5").Entirerow.Hidden = True, but it did not work...


On Tue, 22 Feb 2005 18:30:44 +1100, "Steve"
wrote:

This hide's a sheet if OK is pressed:

Sub HideSheet()
Dim hideit
hideit = MsgBox("Press OK to hide", vbOKCancel, "Hide Test")

If hideit = 1 Then
Worksheets("Sheet1").Visible = False
Else
Worksheets("Sheet1").Visible = True
End If
End Sub



This does the same with Column C

Sub HideCol()
Dim hideit
hideit = MsgBox("Press OK to hide", vbOKCancel, "Hide Test")

If hideit = 1 Then
Columns("C:C").EntireColumn.Hidden = True
Else
Columns("C:C").EntireColumn.Hidden = False
End If

End Sub

HTH
Steve


jonjo

Hiding/Unhiding sheets and rows (An easy one for most of you....)
 
Rows("2:5").Rows.Hidden = True !

Greetings Jonjo

"Dean Goodmen" wrote:

That works great; however how would you hide multiple rows, or a range
of them?

I tried Rows("2:5").Entirerow.Hidden = True, but it did not work...


On Tue, 22 Feb 2005 18:30:44 +1100, "Steve"
wrote:

This hide's a sheet if OK is pressed:

Sub HideSheet()
Dim hideit
hideit = MsgBox("Press OK to hide", vbOKCancel, "Hide Test")

If hideit = 1 Then
Worksheets("Sheet1").Visible = False
Else
Worksheets("Sheet1").Visible = True
End If
End Sub



This does the same with Column C

Sub HideCol()
Dim hideit
hideit = MsgBox("Press OK to hide", vbOKCancel, "Hide Test")

If hideit = 1 Then
Columns("C:C").EntireColumn.Hidden = True
Else
Columns("C:C").EntireColumn.Hidden = False
End If

End Sub

HTH
Steve



Bunu az Kimse Biliyor

Hiding/Unhiding sheets and rows (An easy one for most of you....)
 
This should work:

For each R in Rows("2:5")
R.Entirerow.Hidden = True
Next

Greetings,
Bunu


"Dean Goodmen" schreef in bericht
...
That works great; however how would you hide multiple rows, or a range
of them?

I tried Rows("2:5").Entirerow.Hidden = True, but it did not work...


On Tue, 22 Feb 2005 18:30:44 +1100, "Steve"
wrote:

This hide's a sheet if OK is pressed:

Sub HideSheet()
Dim hideit
hideit = MsgBox("Press OK to hide", vbOKCancel, "Hide Test")

If hideit = 1 Then
Worksheets("Sheet1").Visible = False
Else
Worksheets("Sheet1").Visible = True
End If
End Sub



This does the same with Column C

Sub HideCol()
Dim hideit
hideit = MsgBox("Press OK to hide", vbOKCancel, "Hide Test")

If hideit = 1 Then
Columns("C:C").EntireColumn.Hidden = True
Else
Columns("C:C").EntireColumn.Hidden = False
End If

End Sub

HTH
Steve





All times are GMT +1. The time now is 08:11 AM.

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