Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Checking array to see if value exists before adding to array

Hi,

I am going round in circles as usual and am doing (at least) one stupid
thing with a lack of logic, so need some help.

I have a list of possible entries that someone can manually enter, which I
then want to check against already entered values of an array and then if
it's not in the array to add it to the next value of the array (up to 4
values).

Can someone please assist me with this or point me in the right direction?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Checking array to see if value exists before adding to array

I think we need some more information. Where is this list of possible
entries at... In a declared VB array? In a range of cells? In a String
variable? Somewhere else? Also, what do you mean by "the already entered
value of an array"... is that an array of cells or a declared VB array?

--
Rick (MVP - Excel)


"Wullie" wrote in message
...
Hi,

I am going round in circles as usual and am doing (at least) one stupid
thing with a lack of logic, so need some help.

I have a list of possible entries that someone can manually enter, which I
then want to check against already entered values of an array and then if
it's not in the array to add it to the next value of the array (up to 4
values).

Can someone please assist me with this or point me in the right direction?

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Checking array to see if value exists before adding to array

Sorry for the lack of information, I was running out the door as I was typing
it.

Basically, I have a sheet which will holds a number of optional units which
a student can select as part of an overall course.

When a new persons name is added to a column on the sheet 4 mandatory
courses are selected (by putting X in the column beside unit name). The user
is then prompted with an inputbox to enter the code number of the selected
unit. This then loops through the courses to find the selected unit and put
an X in the corresponding box. The input box happens 4 times for 4 optional
units.

This all works OK at the moment, but allows the user to be able to enter the
same course code 4 times, rather than removing the selected one from the
options.

I was trying to get option 1 stored into an array in element 1, then get
option 2 to check if this is the same choice as option 1 and if not, store it
in array element 2, then option 3 to check element 1 and 2 and so on...

At the moment, my code (which I can post tomorrow if required - it's at
work, I'm at home) does all of this but my lack of logic in my code has ment
that where I have my check/add to array, it is adding each option to all of
the array elements.

Just wondering if anyone can help/point me in the direction of a bit of code
that will check the array to see if the value already exists, and if not, add
it to the next element.

Hope this makes a lot more sense, now that I have time to type a bit more in
depth.

Thanks


"Rick Rothstein" wrote:

I think we need some more information. Where is this list of possible
entries at... In a declared VB array? In a range of cells? In a String
variable? Somewhere else? Also, what do you mean by "the already entered
value of an array"... is that an array of cells or a declared VB array?

--
Rick (MVP - Excel)


"Wullie" wrote in message
...
Hi,

I am going round in circles as usual and am doing (at least) one stupid
thing with a lack of logic, so need some help.

I have a list of possible entries that someone can manually enter, which I
then want to check against already entered values of an array and then if
it's not in the array to add it to the next value of the array (up to 4
values).

Can someone please assist me with this or point me in the right direction?

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Checking array to see if value exists before adding to array

Yes, I think it would be helpful if you posted your code.

--
Rick (MVP - Excel)


"Wullie" wrote in message
...
Sorry for the lack of information, I was running out the door as I was
typing
it.

Basically, I have a sheet which will holds a number of optional units
which
a student can select as part of an overall course.

When a new persons name is added to a column on the sheet 4 mandatory
courses are selected (by putting X in the column beside unit name). The
user
is then prompted with an inputbox to enter the code number of the selected
unit. This then loops through the courses to find the selected unit and
put
an X in the corresponding box. The input box happens 4 times for 4
optional
units.

This all works OK at the moment, but allows the user to be able to enter
the
same course code 4 times, rather than removing the selected one from the
options.

I was trying to get option 1 stored into an array in element 1, then get
option 2 to check if this is the same choice as option 1 and if not, store
it
in array element 2, then option 3 to check element 1 and 2 and so on...

At the moment, my code (which I can post tomorrow if required - it's at
work, I'm at home) does all of this but my lack of logic in my code has
ment
that where I have my check/add to array, it is adding each option to all
of
the array elements.

Just wondering if anyone can help/point me in the direction of a bit of
code
that will check the array to see if the value already exists, and if not,
add
it to the next element.

Hope this makes a lot more sense, now that I have time to type a bit more
in
depth.

Thanks


"Rick Rothstein" wrote:

I think we need some more information. Where is this list of possible
entries at... In a declared VB array? In a range of cells? In a String
variable? Somewhere else? Also, what do you mean by "the already entered
value of an array"... is that an array of cells or a declared VB array?

--
Rick (MVP - Excel)


"Wullie" wrote in message
...
Hi,

I am going round in circles as usual and am doing (at least) one stupid
thing with a lack of logic, so need some help.

I have a list of possible entries that someone can manually enter,
which I
then want to check against already entered values of an array and then
if
it's not in the array to add it to the next value of the array (up to 4
values).

Can someone please assist me with this or point me in the right
direction?

Thanks




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Checking array to see if value exists before adding to array

Thanks for the offer of help Rick.

I changed my code and instead of the user entering values into an input box,
I created a userform with a list of all units and got the user to
select/deselect the required ones, then read the selection out of the list
back into the main code to populate the required boxes with an "X".

Again, thanks anyway

"Rick Rothstein" wrote:

Yes, I think it would be helpful if you posted your code.

--
Rick (MVP - Excel)


"Wullie" wrote in message
...
Sorry for the lack of information, I was running out the door as I was
typing
it.

Basically, I have a sheet which will holds a number of optional units
which
a student can select as part of an overall course.

When a new persons name is added to a column on the sheet 4 mandatory
courses are selected (by putting X in the column beside unit name). The
user
is then prompted with an inputbox to enter the code number of the selected
unit. This then loops through the courses to find the selected unit and
put
an X in the corresponding box. The input box happens 4 times for 4
optional
units.

This all works OK at the moment, but allows the user to be able to enter
the
same course code 4 times, rather than removing the selected one from the
options.

I was trying to get option 1 stored into an array in element 1, then get
option 2 to check if this is the same choice as option 1 and if not, store
it
in array element 2, then option 3 to check element 1 and 2 and so on...

At the moment, my code (which I can post tomorrow if required - it's at
work, I'm at home) does all of this but my lack of logic in my code has
ment
that where I have my check/add to array, it is adding each option to all
of
the array elements.

Just wondering if anyone can help/point me in the direction of a bit of
code
that will check the array to see if the value already exists, and if not,
add
it to the next element.

Hope this makes a lot more sense, now that I have time to type a bit more
in
depth.

Thanks


"Rick Rothstein" wrote:

I think we need some more information. Where is this list of possible
entries at... In a declared VB array? In a range of cells? In a String
variable? Somewhere else? Also, what do you mean by "the already entered
value of an array"... is that an array of cells or a declared VB array?

--
Rick (MVP - Excel)


"Wullie" wrote in message
...
Hi,

I am going round in circles as usual and am doing (at least) one stupid
thing with a lack of logic, so need some help.

I have a list of possible entries that someone can manually enter,
which I
then want to check against already entered values of an array and then
if
it's not in the array to add it to the next value of the array (up to 4
values).

Can someone please assist me with this or point me in the right
direction?

Thanks




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Redimming an array dynamically assigned from range (how to redim first dimension of a 2-D array? /or/ reverse the original array order) Keith R[_2_] Excel Programming 3 November 13th 07 04:08 PM
VLOOK up returning #N/A even though value exists in lookup array [email protected] Excel Worksheet Functions 1 September 4th 07 06:56 PM
If worksheet from array exists then not working [email protected] Excel Programming 1 May 16th 07 09:33 AM
Lookup value - see if exists in another array [email protected] Excel Worksheet Functions 1 March 1st 07 03:55 PM
need array of true/false if text exists alex Excel Worksheet Functions 0 November 16th 04 09:58 AM


All times are GMT +1. The time now is 08:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"