Hi there,
I have a Macro that is hiding both blank rows and columns in one tab. I want to modify this to only hide blank rows in a different tab. Can anyone help me figure out which parts of this macro I need to delete?
Thanks!
Sub Hide()
Application.ScreenUpdating = False
'The above doesn't show all the steps. It is cosmetic.
'unhide rows and columns first. If new rows or columns are added we may need to extend ranges
Sheets("6 - Analysis CF").Select
Rows("16:250").Select
Selection.EntireRow.Hidden = False
Columns("G:ZZ").Select
Selection.EntireColumn.Hidden = False
Sheets("6 - Analysis CF").Select
'Rows hiding
For i = 26 To 250
CellContents = Range("A" & i).Value
'range A for column i variable for all the rows.
If CellContents = "NoValue" Then
Rows(i & ":" & i).Select
'It evaluates one row each time.
Selection.EntireRow.Hidden = True
Range("A" & i).Select
End If
Next
'Columns hiding
Range("H1").Select
'This needs to be the first cell that has our Value/NoValue formula
DoneCounting = False
' The donecounting is Boolean i.e. True/False.
Do Until DoneCounting = True
If ActiveCell.Value = "NoValue" Then
Selection.EntireColumn.Hidden = True
ElseIf ActiveCell.Value = "" Then
'This ="" means blank. This will stop our Loop i.e. our Macro
DoneCounting = True
Exit Do
End If
ActiveCell.Offset(0, 1).Activate
' This means that if E1 is value go to the next column and look for Value/NoValue condition
Loop
Sheets("6 - Analysis CF").Select
Range("H22").Select
'This puts the cursor in cell H22
MsgBox ("Done Hiding")
End Sub
Sub UnHide()
Application.ScreenUpdating = False
'unhide rows and columns. If new rows or columns are added we may need to extend ranges
Rows("16:250").Select
Selection.EntireRow.Hidden = False
Columns("G:ZZ").Select
Selection.EntireColumn.Hidden = False
Sheets("6 - Analysis CF").Select
Range("A1").Select
MsgBox ("Done Unhiding")
End Sub
I have a Macro that is hiding both blank rows and columns in one tab. I want to modify this to only hide blank rows in a different tab. Can anyone help me figure out which parts of this macro I need to delete?
Thanks!
Sub Hide()
Application.ScreenUpdating = False
'The above doesn't show all the steps. It is cosmetic.
'unhide rows and columns first. If new rows or columns are added we may need to extend ranges
Sheets("6 - Analysis CF").Select
Rows("16:250").Select
Selection.EntireRow.Hidden = False
Columns("G:ZZ").Select
Selection.EntireColumn.Hidden = False
Sheets("6 - Analysis CF").Select
'Rows hiding
For i = 26 To 250
CellContents = Range("A" & i).Value
'range A for column i variable for all the rows.
If CellContents = "NoValue" Then
Rows(i & ":" & i).Select
'It evaluates one row each time.
Selection.EntireRow.Hidden = True
Range("A" & i).Select
End If
Next
'Columns hiding
Range("H1").Select
'This needs to be the first cell that has our Value/NoValue formula
DoneCounting = False
' The donecounting is Boolean i.e. True/False.
Do Until DoneCounting = True
If ActiveCell.Value = "NoValue" Then
Selection.EntireColumn.Hidden = True
ElseIf ActiveCell.Value = "" Then
'This ="" means blank. This will stop our Loop i.e. our Macro
DoneCounting = True
Exit Do
End If
ActiveCell.Offset(0, 1).Activate
' This means that if E1 is value go to the next column and look for Value/NoValue condition
Loop
Sheets("6 - Analysis CF").Select
Range("H22").Select
'This puts the cursor in cell H22
MsgBox ("Done Hiding")
End Sub
Sub UnHide()
Application.ScreenUpdating = False
'unhide rows and columns. If new rows or columns are added we may need to extend ranges
Rows("16:250").Select
Selection.EntireRow.Hidden = False
Columns("G:ZZ").Select
Selection.EntireColumn.Hidden = False
Sheets("6 - Analysis CF").Select
Range("A1").Select
MsgBox ("Done Unhiding")
End Sub