+ Reply to Thread
Results 1 to 17 of 17

Basic User list items , search, Edit from three sheets

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Basic User list items , search, Edit from three sheets

    Hi all,
    I have created a basic userform with two text boxes just to learn.
    I have visited other websites and examples and still unable to get it right.

    I can learn by studying this one I have created.
    If anyone is willing to help please.

    Sheet1 has Names & Number populated from userform- works OK with 'Edit/Add' Button
    Userform close button works OK

    There is a List box and I want to populate data in list box by pressing search button
    If I click on any name in the list then it should show in Textbox 1 & 2

    To add / search /edit data from three sheets ( have identical data) I have given command buttons
    'New' 'Inuse' 'Finished' ( Which are names of the sheets as well)
    This should facilitate me to to that.

    Please help / hint so that I can learn.

    Many thanks
    kind regards
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Basic User list items , search, Edit from three sheets

    Hi all,
    Error in the title... It should say ...Basic UserForm list items , search, Edit from three sheets
    Apology

  3. #3
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Basic User list items , search, Edit from three sheets

    Hi all,
    To Start with.
    Please guide me how do I list all entries from sheet1 ( NEW) to a list box.
    When clicked on any name in the list, it populates it in the Text boxes.

    many thanks
    Kind regards

  4. #4
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Basic User list items , search, Edit from three sheets

    Hi all,
    I am getting there but still need help Please. Bit slow in learning.
    Thanks
    Kind regards

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Basic User list items , search, Edit from three sheets

    Hello

    I modified your user form adding a combobox to choose your sheets names. Then using the advanced filter i get your results in listbox using a (helper) sheet-we can use a range to an existing sheet if you prefer this.

    Private Sub ComboBox1_Change()
    Sheets("results").Range("a2") = Me.ComboBox1.Text
    If Sheets("results").Range("a2") = "Inuse" Then
        Sheets("Inuse").Columns("A:B").AdvancedFilter Action:=xlFilterCopy, _
            CopyToRange:=Sheets("results").Range("F1:G1"), Unique:=False
            End If
         If Sheets("results").Range("a2") = "New" Then
        Sheets("New").Columns("A:B").AdvancedFilter Action:=xlFilterCopy, _
            CopyToRange:=Sheets("results").Range("F1:G1"), Unique:=False
            End If
            If Sheets("results").Range("a2") = "Finished" Then
        Sheets("Finished").Columns("A:B").AdvancedFilter Action:=xlFilterCopy, _
            CopyToRange:=Sheets("results").Range("F1:G1"), Unique:=False
            End If
    End Sub
    Attached Files Attached Files
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Basic User list items , search, Edit from three sheets

    ..and for your second part of your question..use this.
    Private Sub ListBox1_Click()
      
        If Me.ListBox1.ListIndex = -1 Then 'not selected
            MsgBox " No selection made"
        ElseIf Me.ListBox1.ListIndex >= 1 Then 'User has selected
            r = Me.ListBox1.ListIndex
            With Me
                .TextBox1.Value = ListBox1.List(r, 0)
                .TextBox2.Value = ListBox1.List(r, 1)
                 
            End With
        End If
    End Sub

  7. #7
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Basic User list items , search, Edit from three sheets

    Hi Fotis1991,
    Really appriciated your help.
    I have understood the helper sheet concept now.
    However when we select sheet e.g. 'New' then it lists items in that. very well
    But when I click on any name it will not populate them in the text boxes for me to edit it.
    Am I going wrong somewhere?
    Please help. We are almost there.
    Kind regards

  8. #8
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Basic User list items , search, Edit from three sheets

    It will not allow me to give feedback. I don't know why.
    Here it is
    Exceptional , Kind and accurate help be Fotis1991. Thanks

  9. #9
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Basic User list items , search, Edit from three sheets

    Hi again,
    We were typing at the same time.
    You answered the question before I had asked.
    What a speed....
    Really thanks
    This gives me lots of material to study your codes.

    Many thanks
    Kind regards

  10. #10
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Basic User list items , search, Edit from three sheets

    You are welcome and thanks for the feedback.

    The system does not allows you to give me a rep because-probably-i am the one that you gived a rep, in your previous thread! No worries. You oguht one to me!

  11. #11
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Basic User list items , search, Edit from three sheets

    Hi
    It just allowed me for Rep.
    I have done it

  12. #12
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Basic User list items , search, Edit from three sheets

    Thanks for the rep!

    I have also modified the code in edit button. Perhaps should be interesting for you.
    Private Sub CommandButton5_Click()
    Dim lastrow As Long
    If Sheets("results").Range("a2") = "New" Then
    lastrow = Worksheets("New").Range("A" & Rows.Count).End(xlUp).Row
    
    With Worksheets("New").Range("a1")
    .Offset(lastrow, 0).Value = Me.TextBox1.Text
      .Offset(lastrow, 1).Value = Me.TextBox2.Value
    
       TextBox1.Value = ""
      TextBox2.Value = ""
      TextBox1.Value = ""
      
     End With
     End If
     If Sheets("results").Range("a2") = "Inuse" Then
    lastrow = Worksheets("Inuse").Range("A" & Rows.Count).End(xlUp).Row
    
    With Worksheets("Inuse").Range("a1")
    .Offset(lastrow, 0).Value = Me.TextBox1.Text
      .Offset(lastrow, 1).Value = Me.TextBox2.Value
    
       TextBox1.Value = ""
      TextBox2.Value = ""
      TextBox1.Value = ""
      
     End With
     End If
      If Sheets("results").Range("a2") = "Finished" Then
    lastrow = Worksheets("Finished").Range("A" & Rows.Count).End(xlUp).Row
    
    With Worksheets("Finished").Range("a1")
    .Offset(lastrow, 0).Value = Me.TextBox1.Text
      .Offset(lastrow, 1).Value = Me.TextBox2.Value
    
       TextBox1.Value = ""
      TextBox2.Value = ""
      TextBox1.Value = ""
      
     End With
     End If
    End Sub

  13. #13
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Basic User list items , search, Edit from three sheets

    Indeed Sir
    You dont know what your kind help means to me.
    Its like a gold mine of knowledge from Gurus like you.
    What I do is now study what you have done and why
    Step by step.
    Then it gives me insight into the codes to get understanding and Learn.
    Slow but steady.
    Kind regards

  14. #14
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Basic User list items , search, Edit from three sheets

    Hi Again,
    I will await some time and ask just one more question that I have as per rule if it is OK with you.
    Apology
    Kind regards

  15. #15
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Basic User list items , search, Edit from three sheets

    Very Grateful Sir.
    Very interesting one. A lot to study
    There is a issue with record.
    If we select 'New' and select any existing record from list box.
    It appears in the text boxes .
    But when I amend them, it goes as a new entry rather than amend the existing one.

    This does not happen on other sheets. It works perfectly.
    I guess some where something needs small correction.
    ind regards

  16. #16
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Basic User list items , search, Edit from three sheets

    After so many good news, now the bad news.

    The code in command button5(which is a modification of the code that exists in your first workbook example) does not edit the names or the numbers. Just adds as a new record in first available row of eatch sheet.

    Unfortunately i don't know how to do this(the edit). Sorry.

  17. #17
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Basic User list items , search, Edit from three sheets

    No No Sir,
    That OK. You helped me greatly.
    You deserve
    I am posting it as a new thread now.
    Kind regards

+ 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. Add, search and edit using a user form
    By clint182 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-24-2013, 09:18 PM
  2. Search for/Edit Records with a User Form
    By LONeill13 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2013, 03:24 PM
  3. search and edit row through user form
    By robert.begley1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-04-2012, 09:30 AM
  4. Select, Edit, Add & Delete items in a list box
    By baisty182 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-10-2010, 07:25 AM
  5. User Form List items to link to other sheets in the workbook
    By ravergirl7216 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2010, 02:00 PM

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