PDA

View Full Version : Solved: Show the next months Lists



slamet Harto
08-08-2008, 01:15 AM
Guys,

Hope you are well.
I need your help to modify the vba code that I use for hide all the lists in entire row based on criteria.

In this case, i want to show the list if this monht is August 08. then show the list for Sept 08. start from the 1st sept 08 to 30 Sept 08.

Appreciate your help. thank you!

xld
08-08-2008, 01:47 AM
Sub HideNextMonth()
Dim LastRow As Long

With ActiveSheet

.Columns("O").Insert
.Range("O5").Value = "Key"
LastRow = .Cells(.Rows.Count, "K").End(xlUp).Row
.Range("O6").Resize(LastRow - 5).Formula = "=TEXT(K6,""mmyyyy"")"
.Range("O5").Resize(LastRow - 4).AutoFilter _
field:=1, Criteria1:=Format(DateSerial(Year(Date), Month(Date) + 1, 1), "mmyyyy")
.Columns("O").Hidden = True
End With
End Sub

Sub restoreWS()
With ActiveSheet.Columns("O")
.Hidden = False
.Delete
End With
End Sub

slamet Harto
08-08-2008, 10:46 PM
Hi Bob,

Work fine.
As usual, Thank you so much.

Best, Harto