Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default [HELP WITH ARRAY] Simple for you, very hard for me....please

Help please!!!!.

I have a simple array with name of cities in it.
I have in the coloumn "A" a list of city's names.

I should verify that every city included in the array can be found in
the coloumn "A".

How can I do that?. I believe with for, next array.count etc. but I
have many difficulties....

Please help!!!!.
Thanks in advance.
Alex.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default [HELP WITH ARRAY] Simple for you, very hard for me....please

For i = LBound(ary) To UBound(ary)
If IsError(Application.Match(ary(i),Columns(1),0)) Then
Msgbox ary(I) & " not found"
End If
Next i

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Alex" wrote in message
oups.com...
Help please!!!!.

I have a simple array with name of cities in it.
I have in the coloumn "A" a list of city's names.

I should verify that every city included in the array can be found in
the coloumn "A".

How can I do that?. I believe with for, next array.count etc. but I
have many difficulties....

Please help!!!!.
Thanks in advance.
Alex.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Simple for you, very hard for me....please


Alex wrote:
I have a simple array with name of cities in it.
I have in the coloumn "A" a list of city's names.

I should verify that every city included in the array can be found in
the coloumn "A".

How can I do that?. I believe with for, next array.count etc. but I
have many difficulties....


Hello Alex,
Good evening. What is the delimiter used in the City Name Array?
Anyway, you will be parsing the full array to get the individual names.
Use a loop...

Dim name()
Dim iniLet
for m= 0 to numberOfCitiesIntheBigArray
inilet=Mid(name(m), 1, 1)
if iniLet="A" then
List1.additem name(m)
Next m

'...ListBox, or combo or text box whatever it is
Hope this will help

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Simple for you, very hard for me....please


ha scritto:

Alex wrote:
I have a simple array with name of cities in it.
I have in the coloumn "A" a list of city's names.

I should verify that every city included in the array can be found in
the coloumn "A".

How can I do that?. I believe with for, next array.count etc. but I
have many difficulties....


Hello Alex,
Good evening. What is the delimiter used in the City Name Array?
Anyway, you will be parsing the full array to get the individual names.
Use a loop...

Dim name()
Dim iniLet
for m= 0 to numberOfCitiesIntheBigArray
inilet=Mid(name(m), 1, 1)
if iniLet="A" then
List1.additem name(m)
Next m

'...ListBox, or combo or text box whatever it is
Hope this will help



Thanks for fast answer but maybe I didn't explain well.

In "arraycities" I have the name of the cities.
In the Excel file, in the column "A" I have a list of 100 cities.
I must verify if the city name in the array is included in the column
"A" of the Excel file:

So I thought something like (arraycities is a Collection already
filled):

For y = 1 To arraycities.Count 'take the first city of the array
For i = 1 to 100 'take the first city of the excel file

cityinthefile=Cells(i,1)
if arraycities(y)=cityinthefile 'ok should pass to another item of the
collection...
next y
'and restarting to cells(1,1) in the excel file...
exit for????

else

....'and when a city in the array is not present in the 100 first row of
coloumn "A" stop the procedure.

Hope it's more clear now.
I'm sorry to bother you all but this is important to me.

Thank you for your time.

Alex.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Simple for you, very hard for me....please

Bob Phillips provided an answer that should work.

--
Regards,
Tom Ogilvy


"Alex" wrote:


ha scritto:

Alex wrote:
I have a simple array with name of cities in it.
I have in the coloumn "A" a list of city's names.

I should verify that every city included in the array can be found in
the coloumn "A".

How can I do that?. I believe with for, next array.count etc. but I
have many difficulties....


Hello Alex,
Good evening. What is the delimiter used in the City Name Array?
Anyway, you will be parsing the full array to get the individual names.
Use a loop...

Dim name()
Dim iniLet
for m= 0 to numberOfCitiesIntheBigArray
inilet=Mid(name(m), 1, 1)
if iniLet="A" then
List1.additem name(m)
Next m

'...ListBox, or combo or text box whatever it is
Hope this will help



Thanks for fast answer but maybe I didn't explain well.

In "arraycities" I have the name of the cities.
In the Excel file, in the column "A" I have a list of 100 cities.
I must verify if the city name in the array is included in the column
"A" of the Excel file:

So I thought something like (arraycities is a Collection already
filled):

For y = 1 To arraycities.Count 'take the first city of the array
For i = 1 to 100 'take the first city of the excel file

cityinthefile=Cells(i,1)
if arraycities(y)=cityinthefile 'ok should pass to another item of the
collection...
next y
'and restarting to cells(1,1) in the excel file...
exit for????

else

....'and when a city in the array is not present in the 100 first row of
coloumn "A" stop the procedure.

Hope it's more clear now.
I'm sorry to bother you all but this is important to me.

Thank you for your time.

Alex.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Simple for you, very hard for me....please


Bob Phillips ha scritto:

For i = LBound(ary) To UBound(ary)
If IsError(Application.Match(ary(i),Columns(1),0)) Then
Msgbox ary(I) & " not found"
End If
Next i

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Alex" wrote in message
oups.com...
Help please!!!!.

I have a simple array with name of cities in it.
I have in the coloumn "A" a list of city's names.

I should verify that every city included in the array can be found in
the coloumn "A".

How can I do that?. I believe with for, next array.count etc. but I
have many difficulties....

Please help!!!!.
Thanks in advance.
Alex.



Thank you very much.
This works!. And it's a very powerful command (Application.Match) that
will help me very much in the future.

Thanks again,
Alex.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Simple for you, very hard for me....please


Tom Ogilvy ha scritto:

Bob Phillips provided an answer that should work.

--
Regards,
Tom Ogilvy


"Alex" wrote:


ha scritto:

Alex wrote:
I have a simple array with name of cities in it.
I have in the coloumn "A" a list of city's names.

I should verify that every city included in the array can be found in
the coloumn "A".

How can I do that?. I believe with for, next array.count etc. but I
have many difficulties....

Hello Alex,
Good evening. What is the delimiter used in the City Name Array?
Anyway, you will be parsing the full array to get the individual names.
Use a loop...

Dim name()
Dim iniLet
for m= 0 to numberOfCitiesIntheBigArray
inilet=Mid(name(m), 1, 1)
if iniLet="A" then
List1.additem name(m)
Next m

'...ListBox, or combo or text box whatever it is
Hope this will help



Thanks for fast answer but maybe I didn't explain well.

In "arraycities" I have the name of the cities.
In the Excel file, in the column "A" I have a list of 100 cities.
I must verify if the city name in the array is included in the column
"A" of the Excel file:

So I thought something like (arraycities is a Collection already
filled):

For y = 1 To arraycities.Count 'take the first city of the array
For i = 1 to 100 'take the first city of the excel file

cityinthefile=Cells(i,1)
if arraycities(y)=cityinthefile 'ok should pass to another item of the
collection...
next y
'and restarting to cells(1,1) in the excel file...
exit for????

else

....'and when a city in the array is not present in the 100 first row of
coloumn "A" stop the procedure.

Hope it's more clear now.
I'm sorry to bother you all but this is important to me.

Thank you for your time.

Alex.



Yes, thank you to all of you.
Alex.

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
simple but hard question Wu Excel Discussion (Misc queries) 1 November 10th 07 06:39 AM
simple but very hard question Wu Excel Discussion (Misc queries) 3 October 27th 07 04:44 PM
Simple for you hard for me (newbie alert) NathanS[_2_] Excel Programming 4 August 15th 05 05:52 PM
Simple data/Hard statistics David Excel Programming 2 January 10th 05 04:51 AM
Simple but hard yeshuawatso Excel Worksheet Functions 7 November 26th 04 03:16 PM


All times are GMT +1. The time now is 04:28 AM.

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"