Consulting

Results 1 to 4 of 4

Thread: Sleeper: Select and delete

  1. #1

    Sleeper: Select and delete

    I am looking at the possibility of giving a user "select and delete options", but I am not sure of the best solution.

    I have a sheet(1) column A that lists all warehouse names and column B is the associated part #'s for the warehouse.

    Example

    North YBAT12
    North YBBU19
    North ZZR321
    South ACED15
    South YBAT12

    I am think along the lines of pivot table(ing) the part # column to give me a single list of part #'s. Then filling a listbox with the part #'s. The user can then select from the list of part #'s(multiple if needed)then hit a button to delete all occurrances of the part # and row information(via autofilter).

    In the example above part # YBAT12 is located in the North and South warehouses. If a user selected YBAT12 to delete - that part # would vanish leaving the rest.

    Any idea's would be greatly appreciated.

    Thanks,

    Kurt

  2. #2
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location
    I am not sure I fully understand what you propose. Do you intend to actually delete information or simply not display certain information using, say, autofilter? If the latter, might it be better to call it something other than delete?

  3. #3
    you can accomplish this with a userform with comboboxes, you only have to check for double occurances, fill up a combobox with the part numbers and then be able to select the part from a list and delete the entire row.

  4. #4
    MWE -

    It would be delete. Autofilter can be called to find the part #(s) then delete.

    Regioun - Thanks for your post also. I am trying to avoid using the UF if possible.

    So far to this point - I have put a listbox & commandbutton on my sheet with the following code:


    Private Sub CommandButton1_Click()
    Dim i As Integer
    Dim Msg As String
    With ListBox1
      For i = 0 To .ListCount - 1
        If .Selected(i) = True Then
            If Msg = "" Then
              Msg = .List(i)
            Else
              Msg = Msg & ", " & .List(i)
            End If
        End If
      Next i
    End With
    With ActiveSheet
      .Range("AH" & .Rows.Count).End(xlUp). _
                Offset(1, 0).Value = Msg
    End With
    For i = 0 To ListBox1.ListCount - 1
       ListBox1.Selected(i) = False
    Next
    End Sub
    I have change the listbox property to multi and pointed at the pivot table with the part numbers on it.

    Thanks,

    Kurt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •