ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hiding Columns (https://www.excelbanter.com/excel-programming/397498-hiding-columns.html)

David A.

Hiding Columns
 
I need to know how to do this for rows instead of columns.
I have the same issue but with rows instead.


Public Sub MyHide()
Dim rngCell As Range
Dim lngNumColumns As Long

Application.ScreenUpdating = False

lngNumColumns = ActiveSheet.UsedRange.Columns.Count

For Each rngCell In Range("A3").Resize(1, lngNumColumns)
With rngCell
.EntireColumn.Hidden = (.Value = 1)
End With
Next rngCell

Application.ScreenUpdating = True
End Sub



FSt1

Hiding Columns
 
hi.
read through your code. where is says column, change that to row. if it says
columns, change that to rows. the command to hide and unhide rows and columns
is the same except for row or column.

regards
FSt1

"David A." wrote:

I need to know how to do this for rows instead of columns.
I have the same issue but with rows instead.


Public Sub MyHide()
Dim rngCell As Range
Dim lngNumColumns As Long

Application.ScreenUpdating = False

lngNumColumns = ActiveSheet.UsedRange.Columns.Count

For Each rngCell In Range("A3").Resize(1, lngNumColumns)
With rngCell
.EntireColumn.Hidden = (.Value = 1)
End With
Next rngCell

Application.ScreenUpdating = True
End Sub



David A.

Hiding Columns
 
Thank you so much. I did want to touch anything and mess up what I have
already did.

Thanx,

"FSt1" wrote:

hi.
read through your code. where is says column, change that to row. if it says
columns, change that to rows. the command to hide and unhide rows and columns
is the same except for row or column.

regards
FSt1

"David A." wrote:

I need to know how to do this for rows instead of columns.
I have the same issue but with rows instead.


Public Sub MyHide()
Dim rngCell As Range
Dim lngNumColumns As Long

Application.ScreenUpdating = False

lngNumColumns = ActiveSheet.UsedRange.Columns.Count

For Each rngCell In Range("A3").Resize(1, lngNumColumns)
With rngCell
.EntireColumn.Hidden = (.Value = 1)
End With
Next rngCell

Application.ScreenUpdating = True
End Sub




All times are GMT +1. The time now is 02:48 PM.

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