VISHAL120
08-29-2011, 10:23 PM
Hi can you please help to shorten these codes:
sub show_Only_12
Application.ScreenUpdating = False
Sheets("KLoading").Select
Rows("3:32").Select
Selection.EntireRow.Hidden = False
With ActiveSheet
For Each cell In Range("X3:X32")
If cell.Value = "7" Then
cell.EntireRow.Hidden = True
End If
Next
End With
With ActiveSheet
For Each cell In Range("X3:X32")
If cell.Value = "12" Then
cell.EntireRow.Hidden = True
End If
Next
End With
With ActiveSheet
For Each cell In Range("X3:X32")
If cell.Value = "10" Then
cell.EntireRow.Hidden = True
End If
Next
End With
With ActiveSheet
For Each cell In Range("X3:X32")
If cell.Value = "0" Then
cell.EntireRow.Hidden = True
End If
Next
End With
Range("kLOADING!A1").Offset(Range("KL_Capacity_Area").Row - 1, Range("KL_Capacity_Area").Column - 1).Select
Selection.End(xlToRight).Select
Selection.End(xlToLeft).Select
Application.ScreenUpdating = True
many thanks for the help.
sub show_Only_12
Application.ScreenUpdating = False
Sheets("KLoading").Select
Rows("3:32").Select
Selection.EntireRow.Hidden = False
With ActiveSheet
For Each cell In Range("X3:X32")
If cell.Value = "7" Then
cell.EntireRow.Hidden = True
End If
Next
End With
With ActiveSheet
For Each cell In Range("X3:X32")
If cell.Value = "12" Then
cell.EntireRow.Hidden = True
End If
Next
End With
With ActiveSheet
For Each cell In Range("X3:X32")
If cell.Value = "10" Then
cell.EntireRow.Hidden = True
End If
Next
End With
With ActiveSheet
For Each cell In Range("X3:X32")
If cell.Value = "0" Then
cell.EntireRow.Hidden = True
End If
Next
End With
Range("kLOADING!A1").Offset(Range("KL_Capacity_Area").Row - 1, Range("KL_Capacity_Area").Column - 1).Select
Selection.End(xlToRight).Select
Selection.End(xlToLeft).Select
Application.ScreenUpdating = True
many thanks for the help.