Help with ListBox not showing data when ComboBox value changes.

  • Hello,


    New user here. I tried to use the search option here to find any similar threads but I couldn't see any results similar to mine so I'm posting this in a hope that somebody might be able to help me out with this.


    I'm stuck with this for almost a week now. I have tried to read blogs and watch some YouTube videos but nothing. I do not have any knowledge of Excel VBA, let me put this out there first.


    To the issue at hand. I have a UserForm4 which is MultiPage, two tabs. One is data entry and other is search edit and delete. Almost all the functions on data entry work, apart from print, save and clear. But data can be entered and all good. On the search edit delete tab I have a listbox and search function. I, for the life of me can not make the Get Data button to show the appropriate sheet. I've gotten it to the point that it works but it only shows the data of the sheet which is open in the background. I have a handful of sheet and using a combobox to activate/select the sheet in which data goes. This data entry function as mentioned above is working fine.


    User select the month's name and upon selection the data entered goes in that sheet. Jan, Fab so on and so forth. This works regardless of what sheet is opened in the background. January might be opened and if combobox selection of month is Feb then data will go in Feb, no problem! Same can not be said for ListBox, it only shows data from the sheet which is opened in the background. I have tried so much and due to the lack of knowledge I'm stuck at this. I have to make the search function somehow but I can not get pass the ListBox.


    I'd appreciate very much any help you guys/girls can give. I would need a code to be honest. I'd be great full if this can be achieved. I also have posted on another forum and no help. I understand and respect that. But I need this sorted and need help. So if anybody here can help me out, I'd appreciate it very much.


    I can either give link of the uploaded file or post the code. I'll post the code and update with file link if somebody needs it.


    Last but not least, my terminologies of excel and vba are at zero. Yes since I've started making this form I'm trying to understand too but, but to be honest and fair my background is not of excel or vba programming. I hope, I really hope this won't put anybody off from helping me lol.



    This one I watched a video on how to get range from a sheet to listbox. Luckily the person who made the video used the exact same thing which I needed so I just copied his example and it works fine with the button. Here's that code.



    Code
    Private Sub cmdClose_Click()
    Unload UserForm4
    End Sub




    I'm hoping this can be achieved and when the month is selected form the cboMonths to enter data then lstData shows up to date data and if cboMonths value is changed and that sheet is "not" opened in the worksheet, lstData still shows the selection made from cboMonths. That's all, for now. Thanks in advance for your help.


    Cheers.



    P.S. I'm using Excel 2016


    [USER="20913"]StephenR[/USER] Thanks a bunch for the clean up of OP, I appreciate it. Yes I did said I asked this question elsewhere and this is the link to the cross post,

  • I suggest you post a small sample workbook. Also, please can you format your code as it's not currently readable.


    Thank you for your reply [USER="20913"]StephenR[/USER] it's much appreciated. I did formatted the code correctly and put it in the " " by using the icon in post section but for some reason it showed correctly in the preview but messed up once I posted it. I will try to edit and see if I can make it right. I do have a sample file and the link and you can see it here.


    On the sheet January 2019 is the userform in question. In vba code mode, there are 5 userforms, I know I know, I'm trying to get this work to the best of my ability and keep making a new one when something pops up in mind that this might work that might work. userform5 is a work in progress but it's userform4 which is good to go. All functions work but lstData doesn't work accordingly with cboMonth which is the key element of the useform. I've posted on another form and a member suggested a code but it hasn't worked so the problem is not solved. It goes without saying that I will update here once I have it working so I do not waste anybody's time and help. I appreciate your help and patience with a noob.


    Cheers.

  • Thanks, I've added your code to the first post and removed some other posts as they were cluttering up the thread.


    I've just noticed "I also have posted on another forum and no help".


    Please read this.


    [cp]*[/cp]

  • I wrote a member suggested a code and it hasn't worked so the problem is not solved. I didn't said no help. Please do not miss quote me and kindly edit your post so it reflects correctly. I well and truly appreciate everybody who tries to help and give their time, either here or any other form. Thanks for your help and understanding. Cheers.

  • I quoted directly from your post!


    That's not how it works. If you have posted the question on another forum you are required to post any such links here to avoid people wasting their time. If you don't you are unlikely to get any help.

  • I quoted directly from your post!


    That's not how it works. If you have posted the question on another forum you are required to post any such links here to avoid people wasting their time. If you don't you are unlikely to get any help.


    Thanks for your reply. I did mentioned about the post before you or anybody else pointed it out. Yes didn't mentioned it in the OP I understand and acknowledge it. Not to get into a silly argument or anything, your forum your rules, I understand. No worries, point noted. I said member provided code and it doesn't work. But I still said no help right? OK let me just give thanks for your help in tidying up things and pointing out the rules and all. Much obliged and appreciate it.


    Kindly delete the post and account. I don't think I can do that myself.


    Cheers.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!