doble click to modify selected record in listbox and right click to delete

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
understand step by step :smile:,

how do i enable T_00 to search

is it possible to use part of the old code ?


To search:

Code:
Dim sh As Worksheet, sht As Worksheet


Private Sub CommandButton1_Click()
  If LB_00.ListIndex = -1 Then
    MsgBox "Select item"
    Exit Sub
  End If
  If LB_00.Selected(LB_00.ListIndex) = False Then
    MsgBox "Select item"
    Exit Sub
  End If
  '
  'borrar registro
  Dim fila As Long
  'recupera el número de fila almacenado en el listbox
  fila = Val(LB_00.List(LB_00.ListIndex, 12))
  sh.Rows(fila).Delete
  Call Load_ListBox
  LB_00.Height = "177.95"
End Sub


Private Sub LB_00_Click()
  LB_00.Height = "177.95"
End Sub


Private Sub T_00_Change()
  LB_00.RowSource = ""
  If T_00 = "" Then Exit Sub
  If C_00.ListIndex = -1 Then
    MsgBox "Selecciona una columna"
    Exit Sub
  End If
  Call Load_ListBox
  LB_00.Height = "177.95"
End Sub


Private Sub UserForm_activate()
  Dim r As Range, j As Long
  Set sh = Sheets("EVENTOS")
  Set sht = Sheets("Temp")
  C_00.List = Split("FECHA LUGAR HAB NOMBRE ESTADO VENDEDOR")
  With LB_00
    .ColumnCount = 13
    .ColumnHeads = True
    .ColumnWidths = ("100;100;100;0;80;50;250;100;0;100;100;200;0")
  End With
  Call Load_ListBox
End Sub


Sub Load_ListBox()
  Application.ScreenUpdating = False
  Dim i As Long, j As Long, f As Range, col As Long, existe As Boolean
  
  i = 2
  j = 2
  sht.Cells.Clear
  sh.Rows(1).Copy
  sht.Range("A1").PasteSpecial xlPasteValues
  Do While sh.Range("A" & i) <> ""
    existe = False
    If T_00 = "" Then
      existe = True
    Else
      'aplicar filtros
      Set f = sh.Rows(1).Find(C_00, , xlValues, xlWhole)
      If Not f Is Nothing Then
        col = f.Column
        If LCase(sh.Cells(i, col)) Like "*" & LCase(T_00) & "*" Then
          existe = True
        End If
      End If
    End If
    If existe Then
      sh.Rows(i).Copy
      sht.Range("A" & j).PasteSpecial xlPasteValues
      sht.Range("A" & j).PasteSpecial xlPasteFormats
      sht.Range("M" & j).Value = i  'almacena el número de fila
      j = j + 1
    End If
    i = i + 1
  Loop
  LB_00.RowSource = sht.Name & "!A2:M" & j - 1
  Application.CutCopyMode = False
  Application.ScreenUpdating = True
End Sub


Private Sub Cmd_00_Click()
  Unload Me
  'ActiveWorkbook.Close SaveChanges:=True
End Sub

The wbook
https://www.dropbox.com/s/ozoygnpj5o7dmh3/agenda cenas romanticas2.xlsm?dl=0
 
Upvote 0
thank you i have tried the code but does not work propertly any search removes every item listed in listbox does not filter any record :(
 
Upvote 0
i tried it out

only habitacion and nombre columns are not working , is it posible to charge hole list like all records to the listbox again once your clear textbox search

also when i writing in textbox it is slowing down the pc a lot

thank you
 
Upvote 0
the names in the combo must be equal to the header. to improve performance I would have to check the code, but I don't guarantee it. The characteristics of your sheet, table and how to use the listbox are not the most appropriate.
 
Upvote 0
i gave a it a try and it´s very good work and i like it much . is it posible to use userform1 to add new records ? it probaly needs improvments too
 
Upvote 0
i gave a it a try and it´s very good work and i like it much . is it posible to use userform1 to add new records ? it probaly needs improvments too

Try to improve your userform1 and when you have a specific question, ask me.
 
Upvote 0
OK ,

an other question is since i was using a table and new workbook does not , i have an othe sheet that takes information from that table how do i modify formula to make it work without table

how i must change formula to use sheet EVENTOS without table

example:

Code:
=IFERROR(INDEX([COLOR="#FF0000"]tblEvents[/COLOR],SMALL(IF(Dates=C$6,ROW(Dates)),ROW(1:1))-TableRowStart,4),"")
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,620
Latest member
dsubash

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top