+ Reply to Thread
Results 1 to 6 of 6

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

Hybrid 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

  2. #2
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,625

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

    Private Sub cbxEAName_Change()
    Dim Chk, i As Long
    With Sheets("Splitting")
        Chk = Application.Match(cbxEAName, .Columns(3), 0)
        ListBox1.List = .Cells(Chk, 1).CurrentRegion.Value
    End With
    With ListBox1
        For i = 1 To .ListCount - 1
            .List(i, 4) = Format(.List(i, 4), "#,##0.00")
            .List(i, 5) = Format(.List(i, 5), "#,##0.00")
            .List(i, 6) = Format(.List(i, 6), "#,##0.00")
        Next i
    End With
    End Sub
    Last edited by Sintek; 06-20-2024 at 06:52 AM.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

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

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

    thanks sintek .
    may you guide me how show numberformat(#,##0.00) in numbers columns into listbox?

  4. #4
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,625

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

    See above amendment...

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

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

    Thank you so much.

  6. #6
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,625

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

    Happy To Contribute...

+ Reply to Thread

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