Re: $$Excel-Macros$$ Show listbox for user to click check boxes while macro is running

2016-10-17 Thread Paul Schreiner
Is it OK to email you directly?(you can reply to: schreiner_paul @ att.net)
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 11:37 AM, kalimotxo  
wrote:
 

 Yes, that does make sense. I am familiar with the concept of running "For..." 
code from the bottom up, because records will be deleted.
As you mentioned, the goal would indeed be to have a selection once some 
cleanup has already been done. I've put an example below, with the action we're 
discussing indicated by "**":-  the initial data set has 1,000 records in 
columns A:P- the user indicates which client they want to work with (located in 
column A)- VBA deletes 600 records not belonging to that client- in the 
remaining 400 records, there are 275 unique locations (located in column C)- 
** I want to bring up a box that lets the user select which of those 275 
unique locations they do not want to include- They check the box next to 40 
locations- VBA deleted 75 records belonging to those 40 locations, leaving 235 
unique locations and 325 records belonging to them

FYI, I copied your macros over, and ran them just to see what would happen. 
Both gave me "Run-time error '424': Object required":- Private Sub 
Btn_Delete_Click() on line 5: "For nRow = 0 To Form_Records.Lst_Type.ListCount 
- 1". - Private Sub UserForm_Initialize() on line 11: 
"Form_Records.Lst_Type.Clear"
I imagine it's not the code, but rather the fact I haven't yet tailored it 
to my data. But I wanted to let you know.








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  
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

Re: $$Excel-Macros$$ Show listbox for user to click check boxes while macro is running

2016-10-17 Thread kalimotxo
Yes, that does make sense. I am familiar with the concept of running 
"For..." code from the bottom up, because records will be deleted.

As you mentioned, the goal would indeed be to have a selection once some 
cleanup has already been done. I've put an example below, with the action 
we're discussing indicated by "**":
-  the initial data set has 1,000 records in columns A:P
- the user indicates which client they want to work with (located in column 
A)
- VBA deletes 600 records not belonging to that client
- in the remaining 400 records, there are 275 unique locations (located in 
column C)
- ** I want to bring up a box that lets the user select which of those 
275 unique locations they do not want to include
- They check the box next to 40 locations
- VBA deleted 75 records belonging to those 40 locations, leaving 235 
unique locations and 325 records belonging to them


FYI, I copied your macros over, and ran them just to see what would happen. 
Both gave me "Run-time error '424': Object required":
- Private Sub Btn_Delete_Click() on line 5: "For nRow = 0 To 
Form_Records.Lst_Type.ListCount - 1". 
- Private Sub UserForm_Initialize() on line 11: 
"Form_Records.Lst_Type.Clear"

I imagine it's not the code, but rather the fact I haven't yet tailored it 
to my data. But I wanted to let you know.




>
>
>
> 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  > 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_Type
> and 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"

Re: $$Excel-Macros$$ Show listbox for user to click check boxes while macro is running

2016-10-17 Thread Paul Schreiner
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  
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 

Re: $$Excel-Macros$$ Show listbox for user to click check boxes while macro is running

2016-10-17 Thread kalimotxo
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_Type
> and 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 = false
> For inx = 0 to ubound(strArray)
>   if (NewItem = strArray(inx)) then 
>  Flag_Exists = true
>  Exit For
>   end if
> next inx
> if (not flag_Exists) then
>   'Add Item to strArray
> end 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  > 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 

Re: $$Excel-Macros$$ Show listbox for user to click check boxes while macro is running

2016-10-17 Thread Paul Schreiner
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  
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+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 securi

Re: $$Excel-Macros$$ Show listbox for user to click check boxes while macro is running

2016-10-14 Thread kalimotxo

>
>
> 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+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.


Re: $$Excel-Macros$$ Show listbox for user to click check boxes while macro is running

2016-10-14 Thread Paul Schreiner
There are several ways to accomplish something like this.What *I* would do 
personally is something like:Using VBA, I'd create a Dictionary object and 
cycle through the records, inserting entries in the Dictionary Object, thereby 
creating an array of unique values.Then, use the statement:sArray = 
Dict_Obj.keys
to create an array of these unique values.
I'd probably sort the array, then use it to load a userform listbox that allows 
multiple selections.
I created a userform (called Form_Records)that contained one listbox called 
Lst_Typeand a button called "Btn_Delete".
Then I created these two macros that I tested on a file with 130,000 records.
---Option Explicit
Private Sub Btn_Delete_Click()
    Dim Dict_Type, tArray
    Dim nRows, nRow
    Set Dict_Type = CreateObject("Scripting.Dictionary")
    Dict_Type.RemoveAll
    For nRow = 0 To Form_Records.Lst_Type.ListCount - 1
    If (Form_Records.Lst_Type.Selected(nRow)) Then
    Debug.Assert True
    Dict_Type.Add Form_Records.Lst_Type.List(nRow), nRow
    End If
    Next nRow
    Application.ScreenUpdating = False
    nRows = Application.WorksheetFunction.CountA(ActiveSheet.Range("A:A"))
    For nRow = nRows To 2 Step -1
    If (Dict_Type.exists(ActiveSheet.Cells(nRow, "A").Value)) Then
    Cells(nRow, "A").EntireRow.Delete
    End If
    Next nRow
    Application.ScreenUpdating = True
    Unload Form_Records
    MsgBox "Finished"
End SubPrivate Sub UserForm_Initialize()
    Dim Dict_Type, tArray
    Dim nRows, nRow
    Set Dict_Type = CreateObject("Scripting.Dictionary")
    Dict_Type.RemoveAll
    nRows = Application.WorksheetFunction.CountA(ActiveSheet.Range("A:A"))
    For nRow = 2 To nRows
    If (Not Dict_Type.exists(ActiveSheet.Cells(nRow, "A").Value)) Then
    Dict_Type.Add ActiveSheet.Cells(nRow, "A").Value, nRow
    End If
    Next nRow
    Form_Records.Lst_Type.Clear
    tArray = Dict_Type.keys
    For nRow = 0 To UBound(tArray)
    Form_Records.Lst_Type.AddItem tArray(nRow)
    Next nRowEnd Sub



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 11:54 AM, kalimotxo  
wrote:
 

 Hello,
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?-- 
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 

$$Excel-Macros$$ Show listbox for user to click check boxes while macro is running

2016-10-14 Thread kalimotxo
Hello,

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?

-- 
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.