filter and delete

A

AND

Hi,
by this script, I filter some data except the data filled in inputbox.
Now I would delete each data hidden except the data shown.
Can u help me please?
thanks a lot.

Private Sub button1_Click()
Dim rng As Range
Dim c As Range
Dim nr As Long
Dim cond(10) As Variant
Dim i As Integer
Dim S As Intege
S = InputBox("Qual è il numero degli addetti per l'internaz DIURNO?")
Sheets("INT_GG").Select
For i = 1 To S
cond(i) = InputBox("Inserire condizione " & i, "tuoTitolo")
Next
Set rng = Foglio19.Range("G6:G800")
rng.Rows.Hidden = True
For Each c In rng
Select Case c.Value
Case Is = cond(1), cond(2), cond(3), cond(4), cond(5), cond(6), cond(7),
cond(8), cond(9), cond(10)
Foglio19.Rows(c.Row).Hidden = False
Case Else

End Select
Next
End Sub

Public Sub mScopri1()
Dim rng As Range
Set rng = Foglio19.Range("G6:G800")
rng.Rows.Hidden = False
 
B

Bernie Deitrick

BBB,

Try it this way:

Sub button1_Click()
Dim rng As Range
Dim c As Range
Dim nr As Long
Dim cond(10) As Variant
Dim i As Integer
Dim S As Integer
S = InputBox("Qual è il numero degli addetti per l'internaz DIURNO?")
Sheets("INT_GG").Select
For i = 1 To S
cond(i) = InputBox("Inserire condizione " & i, "tuoTitolo")
Next
Set rng = Foglio19.Range("G6:G800")
rng.Rows.Hidden = False 'Changed
For Each c In rng
Select Case c.Value
Case Is = cond(1), cond(2), cond(3), cond(4), cond(5), cond(6), cond(7), cond(8), cond(9), cond(10)
Foglio19.Rows(c.Row).Hidden = True 'Changed
Case Else

End Select
Next

'Added

rng.SpecialCells(xlCellTypeVisible).EntireRow.Delete
rng.Rows.Hidden = False

End Sub
 
D

Dave Peterson

Check your other post, too.
Hi,
by this script, I filter some data except the data filled in inputbox.
Now I would delete each data hidden except the data shown.
Can u help me please?
thanks a lot.

Private Sub button1_Click()
Dim rng As Range
Dim c As Range
Dim nr As Long
Dim cond(10) As Variant
Dim i As Integer
Dim S As Intege
S = InputBox("Qual è il numero degli addetti per l'internaz DIURNO?")
Sheets("INT_GG").Select
For i = 1 To S
cond(i) = InputBox("Inserire condizione " & i, "tuoTitolo")
Next
Set rng = Foglio19.Range("G6:G800")
rng.Rows.Hidden = True
For Each c In rng
Select Case c.Value
Case Is = cond(1), cond(2), cond(3), cond(4), cond(5), cond(6), cond(7),
cond(8), cond(9), cond(10)
Foglio19.Rows(c.Row).Hidden = False
Case Else

End Select
Next
End Sub

Public Sub mScopri1()
Dim rng As Range
Set rng = Foglio19.Range("G6:G800")
rng.Rows.Hidden = False
 
A

AND

Bernie,
u're a genius.
Thank u very much from me and my staff.
u 've solved our issue!!!!!
We're grateful.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top