Results 1 to 6 of 6

problem show TOTAL row for each range based on selected name from combobox on form

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    234

    problem show TOTAL row for each range based on selected name from combobox on form

    Hello,
    I would fix the code when select NAME from combobox and match with column C should show a ll of data in listbox for the name.
    the code has problem , will not show TOTAL row and when show data are not arranged , also I would populate names in combobox 1 fo all of names in column C without duplicates , empty . here is the code .
    Private Sub cbxEAName_Change()
    Dim empfound As Range, firstAddress
        Dim shData As Worksheet
    
        Set shData = ThisWorkbook.Sheets("SPLITTING")
    
        Dim rng As Range
        Set rng = shData.Range("C2:C" & shData.Range("A" & shData.Rows.count).End(xlUp).Row)
    
        With ListBox1
            .Clear
            .ColumnCount = 7
            .ColumnWidths = "90;100;100;100;100;100;100"
            '.TopIndex = 0
            Set empfound = rng.Find(cbxEAName.Value, LookIn:=xlValues, LookAt:=xlWhole)
            If Not empfound Is Nothing Then
                firstAddress = empfound.Address
                Do
                    .AddItem shData.Cells(empfound.Row, "A").Value
                    .List(.ListCount - 1, 1) = shData.Cells(empfound.Row, "B").Value
                    .List(.ListCount - 1, 2) = shData.Cells(empfound.Row, "C").Value
                    .List(.ListCount - 1, 3) = shData.Cells(empfound.Row, "D").Value
                    .List(.ListCount - 1, 4) = shData.Cells(empfound.Row, "E").Value
                    .List(.ListCount - 1, 5) = shData.Cells(empfound.Row, "F").Value
                    .List(.ListCount - 1, 6) = shData.Cells(empfound.Row, "G").Value
                    Set empfound = rng.FindNext(empfound)
                Loop While Not empfound Is Nothing And empfound.Address <> firstAddress
            End If
        End With
    
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] merge TOTAL row for each sheet based on selected name from combobox on userform
    By KalilMe in forum Excel Programming / VBA / Macros
    Replies: 45
    Last Post: 05-21-2024, 03:08 AM
  2. [SOLVED] select range as in the first range without using scroll bar based on combobox on form
    By Ali-M in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-08-2023, 12:52 PM
  3. copy data from form to specific range based on selection combobox
    By tubrak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-14-2021, 07:02 AM
  4. [SOLVED] populate user form combobox based on dynamic range
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2015, 09:22 PM
  5. Replies: 3
    Last Post: 11-11-2014, 10:27 AM
  6. Update Rows in Database based on Combobox selected item on Userform. Problem .
    By jmarriott in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-09-2013, 01:08 PM
  7. Copy rows to new sheet based on date range selected on a form
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-19-2009, 11:40 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1