URGENTLY REQUIRED
I want a VBA excel program in which the program checks a column which has entries in the form of Y and N. What i want is if the column entry is y then display the entry of the other column which has names in it.
So display all the names who have Y in other column and display all the names in case of N. For convenience names are in column A and Column D has 'Y' or 'N'.
I am using userform so it will be very helpful if i am able to display the result in textbox, listbox or something.
Here's an example of how you could do that during your UserForm's initialization routine. This code will examine all the constants in column D for "N" and add the matching names from column A to a form control called lbNames. If your column D values are the results of formulas, then change the xlConstants to xlFormulas:
Private Sub UserForm_Initialize() Dim listItem As Range, ws As Worksheet Set ws = Sheets("Sheet1") For Each listItem In ws.Range("D:D").SpecialCells(xlConstants) With Me.lbNAMES If listItem = "N" Then .AddItem Range("A" & listItem.Row).Value End With Next listItem End Sub
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
Thank you!!!
If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
Now the the thing is i want to make sure that there are no duplicates in the listbox, because whenever i click the button it again adds the up the same list and redundancy occurs.
can u please provide me with the solution for that..
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks