Not a problem.I'll try to clarify:
In your original request, you said that you "wanted to bring up a list".
The way you accomplish that is with a userform.However you want to come up with 
the list, you then use this list to fill in the listbox in the userform.
So, what *I* did was create an initialize event for the form such that, when 
the form is "shown"
(Userform.Show)
Then, the initialize even runs to create a list and add it to the listbox of 
the form.
Then, the second macro is tied to the "go" button (I called it "delete")
so both macros are required, but the form may change based on how you're using 
it.
For instance:If you are creating the list of values BEFORE you open the form, 
then your initialize event simply has to cycle through your list and add the 
values to the listbox.(instead of both creating the list and adding it)
Next, you either have to have the button to process the selected values to 
delete, OR you could make a Terminate event so that it processes the selections 
when you close the userform.(I'd advise against that, since if you choose to 
Cancel, you'd have to make sure you UNSELECT any entries first!)
Now:you've mentioned that you want to run this cleanup routine after a PORTION 
of the data has been processed.Does that mean that you only want to 
list/address the records you've processed?That is:- If you have 1000 records- 
after 200 records, the userform obtains unique values FROM ONLY THE 200 
RECORDS.- You make your selections and the macro button deletes the selected 
records, but ONLY FROM THE FIRST 200- Then the macro proceeds.
If that's how you want it to go, I have a "caution".-You've processed 200 
records (the "pointer" is now at record 201)-You select and delete selected 
record values, which deletes 10 records.
Your pointer is still at record 201, but the previous record 201 has been moved 
to record 191.So, when you proceed, your macro would effective skip 10 records.
That's the reason that in my macro, you'll notice the Delete loop starts at the 
end and moves UP
    For nRow = nRows To 2 Step -1
You'll want to do the same when you delete from your first 200 records.
does that make sense?
Paul-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
----------------------------------------- 

    On Monday, October 17, 2016 10:07 AM, kalimotxo <jamison.foll...@gmail.com> 
wrote:
 

 Hi Paul,
I apologise for the confusion. You are right I did not fully comprehend yet 
what you were proposing, so was probably early in forming an opinion on part of 
it!
 Let me briefly describe the situation I want to accomplish.
1) I have a sheet of data that I run a macro on.2) At a certain point, let's 
say after 20% of the code has already executed, I will want the macro to call 
up a message box of unique locations (I have no problem getting the list made & 
removing duplicates)3) The user will scroll through box, clicking a check mark 
next to the ones they want to select.4) They will then hit the button in the 
message box, at which point the code will continue to the next step, which is 
deleting any record with a location matching one of the checked ones.
Question: are the two sub() you proposed complementary, and I need to integrate 
both of them, or are they two different options for the same thing? As I 
mentioned on Friday, this is completely uncharted territory for me.
Thanks again!

On Monday, October 17, 2016 at 6:43:47 AM UTC-5, Paul Schreiner wrote:
You response is a LITTLE confusing, but it may be that you didn't read the 
entire post.
Your original question was:
I'm running a macro to process some data over several columns. At a midway 
point of the code, I need the macro to bring up a list of possible names. The 
user then can check the ones they do not want, click OK, and then the macro 
will go on to delete all records connected to that name.
The names are in column A, and repeat.
How can I call up a list of all unique names in column A, with a check box 
available for the user to scroll through and pick all the names they wish to?

In my response, I said:
I created a userform (called Form_Records)that contained one listbox called 
Lst_Typeand a button called "Btn_Delete".
You can call the button "Btn_OK" and have the caption read "OK",so that once 
the user selects the keywords to remove, they then "Click OK".

Basically, the approach is:1) Read through data and collect "unique" values 
from column "A"2) Open a userform and the values to a listbox.3) Once items are 
selected, the "OK" button will then store list of items to be deleted.4) Cycle 
through data and delete rows containing selected keywords.
The technique (or "trick") here is in collecting of the list of unique 
values.The most common method is to create an array and add the items to the 
array.However, to check to see if the item is already in the array requires to 
loop through the array:

Flag_Exists = falseFor inx = 0 to ubound(strArray)  if (NewItem = 
strArray(inx)) then      Flag_Exists = true     Exit For  end ifnext inxif (not 
flag_Exists) then  'Add Item to strArrayend if

This works for small data sets, but if you have 5000 rows, the code has to loop 
through the array 5000 times!(you can do things to reduce the number of 
iterations, like: declare the array without a "size" then redim the array and 
increase the size each time you add an item, or declare the array with a size 
larger than the anticipated number of unique values and initialize the array 
with blanks. Then break out of the above loop when the array value is blank.
I like using the Dictionary Object. It eliminates the need for looping through 
an array, checking values, and you don't have to anticipate the maximum number 
of values.It's be REALLY COOL if the object had a "sorted" property, but I 
guess you can't have it all!Paul------------------------------ -----------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
------------------------------ ----------- 

    On Friday, October 14, 2016 4:39 PM, kalimotxo <jamison...@gmail.com> wrote:
 

 


Hi Paul, this sounds pretty good. I'm new to  working with these type of 
objects, so I'll have to read through clearly. One thing I notice, if I 
understand your code correctly, is that I do not want to have to click a button 
to run the code, but rather have it in the middle of my sub(), or else call it 
from my sub(). But once I have it working, I can probably figure that out.
Work done for the day, so I'll let you know Monday if it was successful. But I 
wanted you to know I appreciate the prompt response!-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/ discussexcel
 
FORUM RULES
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
 
NOTE : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros...@ googlegroups.com.
To post to this group, send email to excel-...@googlegroups.com.
Visit this group at https://groups.google.com/ group/excel-macros.
For more options, visit https://groups.google.com/d/ optout.


   
-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
 
NOTE : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at https://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.


   

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at https://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to