View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Edwin Tam (MS MVP) Edwin Tam (MS MVP) is offline
external usenet poster
 
Posts: 48
Default Conditional Row Deleting

I don't understand why you chose to use that setup, and require the user to enter three perfect matches in order to delete. It's very tiring for the user

How about use a multi-column listbox to display your data, and after the user has select an item in the list, and press the delete button, the row in the spreadsheet is deleted

1) Insert a ListBox onto your userform. Call it ListBox1
2) Select the ListBox1 and in Properties window, set the "ColumnCount" to 3
3) You got a Delete button called CommandButton1
4) Place the following code into your userfor

'--------------------------------------------
Private Sub CommandButton1_Click(
With ListBox
If .ListCount 0 The
Worksheets(2).Rows(.ListIndex + 2).Delet
.RemoveItem .ListInde
End I
End Wit
End Su

Private Sub UserForm_Activate(
With Worksheets(2).Range("A1").CurrentRegio
If .Rows.Count 1 The
ListBox1.List() = .Offset(1, 0).Resize(.Rows.Count - 1, 3).Valu
ListBox1.ListIndex =
End I
End Wit
End Su
'---------------------------------------------