Results 1 to 6 of 6

Thread: Not Working : Load data from excel in user form and update / delete

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    VBAX Mentor
    Joined
    Nov 2020
    Location
    Cochin, Kerala
    Posts
    314
    Location
    Thanks a lot snb for this very useful information!
    I became VBAX Contributor by asking help in this forum and not by providing solutions
    I prepared the user form based on my little knowledge in VBA. Your site would have been very useful if I had it before I started working on the user form. Still, a lot of areas I can be simplify the codes based on your notes.
    I referred to your sample user forms and I understand it loads the database into a Listobject first and the database recreated based on the values in the Listobject on clicking save button. Following is my doubts on this -
    (1) My user form is simultaneously used by multiple users to update their daily work. So if I use list object to hold the data first and recreate the database on save, different users will have different additions and deletions.

    I can replace one the code below to list unique sorted values in a column
    Sub ListReportMemberName()
            combb_rpt_name.Clear
            Dim ReportMemberList      As Collection
            Dim rng        As Range
            Dim i          As Long
            Set ReportMemberList = New Collection
            On Error Resume Next
            For Each rng In DestnWS.Range("Table_DB[Member Name]")
                If Not (rng) = Empty Then ReportMemberList.Add CStr(rng), CStr(rng)
            Next
            On Error GoTo 0
            For i = 1 To ReportMemberList.Count
                combb_rpt_name.AddItem ReportMemberList(i)
            Next
            If combb_rpt_name.ListCount = 0 Then combb_rpt_name.AddItem "No Records Available"
    End Sub
    With the code below

    4.5 unique sorted values in a column
    With CreateObject("System.Collections.ArrayList")
    For Each cl In sn
    If cl<>"" And Not .contains(cl) Then .Add cl
    Next
    .Sort
    
    
    ComboBox1.List = Application.Transpose(.toarray())
    End With
    If I need to declare the variables what would be the "cl" variable type; is it collection? and I hope "sn" is a range.
    Last edited by anish.ms; 05-07-2021 at 07:28 AM.

Posting Permissions

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