adamsm
07-02-2010, 05:09 AM
Hi,
I’m trying to delete the selected (multiple) rows simultaneously from the list box and unhide the hidden rows from the worksheet.
Here’s the code I’m having so far.
Private Sub CommandButton_Delete_Click()
Dim i As Long
Dim LastRow As Long
For i = Me.ListBox1.ListCount - 1 To 0 Step -1
If Me.ListBox1.Selected(i) Then
With Range("Data").SpecialCells(xlCellTypeVisible)
.Rows(i + 1).Delete
End With
End If
Next i
Range("A6:A" & LastRow).EntireRow.Hidden = False
SheetFilter
End Sub I assume that this might be done by assigning a value to LastRow.
I would be happy if you could let me know how to do this.
Thanks in advance.
I’m trying to delete the selected (multiple) rows simultaneously from the list box and unhide the hidden rows from the worksheet.
Here’s the code I’m having so far.
Private Sub CommandButton_Delete_Click()
Dim i As Long
Dim LastRow As Long
For i = Me.ListBox1.ListCount - 1 To 0 Step -1
If Me.ListBox1.Selected(i) Then
With Range("Data").SpecialCells(xlCellTypeVisible)
.Rows(i + 1).Delete
End With
End If
Next i
Range("A6:A" & LastRow).EntireRow.Hidden = False
SheetFilter
End Sub I assume that this might be done by assigning a value to LastRow.
I would be happy if you could let me know how to do this.
Thanks in advance.