Spaces betwwen names in combo list

Closed
Mary - 20 Jun 2010 à 21:49
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 22 Jun 2010 à 22:58
Hello,

I have a list of employees, in and out dates as the status (active or inactive), my idea is to show up the employees with the active status records in a list using data validation, besides that Iam getting spaces between the employee names in the combo list because not all the employee are active right now so the list is bringing spaces and names.

This is my file if it helps. https://authentification.site/files/23058853/Book1.xlsx

Thank you. i really dont know how to do it...

Mary


3 responses

rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 766
21 Jun 2010 à 05:29
i dont think it can be done like that. you would need a macro or sort data.
Hi, Do you have an idea how can I do that for my sheet.

I really would appreciate any help you can provide me
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 766
22 Jun 2010 à 22:58
Try this

1. Open book
2. Press ALT + F11 to get into VBE
3. Press CTRL + R to launch Project Explorer
4. Double click on sheet where you have this data
5. Paste code

Private Sub Worksheet_Change(ByVal Target As Range)
Dim lRow As Long

    On Error GoTo Error_Handler

    If (Intersect(Target, Range("C:E")) Is Nothing) Then GoTo End_Sub
    
    Application.EnableEvents = False

    Range(Cells(2, "L"), Cells(Rows.Count, "L").End(xlUp)).Clear
    
   
    
    For lRow = 2 To Cells(Rows.Count, "C").End(xlUp).Row
    
        If (Cells(lRow, "F") = "ACTIVE") Then
            
            Cells(Rows.Count, "L").End(xlUp).Offset(1, 0) = Cells(lRow, "C")
            
        End If
        
      Next lRow
      
End_Sub:

    Application.EnableEvents = True
    Exit Sub
    

Error_Handler:
    MsgBox Err.Description
    GoTo End_Sub
    
End Sub