Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Use data from an external sheet.

Hi,

I am developing an application using Ms Excel 2002. I have a countries
worksheet which holds all the valid countries in one column. This
worksheet is part of my main workbook. The only purpose of this
worksheet is for validating input records that contain a country name.
So whenever I read an input record then I activate this sheet and
check whether the country is valid as follows:
If Not Worksheets(strCountriesWorksheet).Range("a:a").Fin d(strCountry,
LookIn:=xlValues) Is Nothing Then
IsValidCountry = True
End If

I want to know whether there is any better method. Can I load all the
countries from this sheet into some array (or any thing else) and
later use that to search for the country. If so can someone give me
some example code how to use array (or any thing else) for
searching/lookup.

Thanks in advance
Prasad Vanka
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Use data from an external sheet.

Prasad,

one suggestion would be to use Data Validation for the
input cell. Make your list of countires a named rangem
e.g. "CountryList", then set data validation for the data
entry cells to List "=CountryList"

I may have misunderstood the way you're getting your data
into the application however, in which case, my apologies.
Pete.
-----Original Message-----
Hi,

I am developing an application using Ms Excel 2002. I

have a countries
worksheet which holds all the valid countries in one

column. This
worksheet is part of my main workbook. The only purpose

of this
worksheet is for validating input records that contain a

country name.
So whenever I read an input record then I activate this

sheet and
check whether the country is valid as follows:
If Not Worksheets(strCountriesWorksheet).Range("a:a").Fin d

(strCountry,
LookIn:=xlValues) Is Nothing Then
IsValidCountry = True
End If

I want to know whether there is any better method. Can I

load all the
countries from this sheet into some array (or any thing

else) and
later use that to search for the country. If so can

someone give me
some example code how to use array (or any thing else) for
searching/lookup.

Thanks in advance
Prasad Vanka
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Use data from an external sheet.

Hi Pete,
You have misunderstood. CountryList has the list of countries in the
first column. My application reads through an input sheet (that comes
through an email). This input sheet has many columns one of which is
the country id. I have to validate this country id field by checking
whether it exists in the list in the CountryList sheet.
At the moment, for every record read from the input file, I am
activating the CountryList sheet and then checking as follows:
If Not Worksheets(strCountriesWorksheet).Range("a:a").Fin d
(strCountry, LookIn:=xlValues) Is Nothing Then
IsValidCountry = True
End If

My question was whether there is any better way than doing this.
Something like reading the CountryList sheet once and getting all the
values into an array and then use this array for validation.

Can someone help.
Thanks

"Pete McCosh" wrote in message ...
Prasad,

one suggestion would be to use Data Validation for the
input cell. Make your list of countires a named rangem
e.g. "CountryList", then set data validation for the data
entry cells to List "=CountryList"

I may have misunderstood the way you're getting your data
into the application however, in which case, my apologies.
Pete.
-----Original Message-----
Hi,

I am developing an application using Ms Excel 2002. I

have a countries
worksheet which holds all the valid countries in one

column. This
worksheet is part of my main workbook. The only purpose

of this
worksheet is for validating input records that contain a

country name.
So whenever I read an input record then I activate this

sheet and
check whether the country is valid as follows:
If Not Worksheets(strCountriesWorksheet).Range("a:a").Fin d

(strCountry,
LookIn:=xlValues) Is Nothing Then
IsValidCountry = True
End If

I want to know whether there is any better method. Can I

load all the
countries from this sheet into some array (or any thing

else) and
later use that to search for the country. If so can

someone give me
some example code how to use array (or any thing else) for
searching/lookup.

Thanks in advance
Prasad Vanka
.

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
updating external data sheet causes loss of data on linked pages C_F_Dewey Excel Worksheet Functions 0 August 28th 07 11:48 PM
Adding a Comment-Column to an external data-sheet amac Excel Worksheet Functions 0 August 17th 06 01:58 PM
Update External Data source from Excel sheet Lara Jacobs Excel Discussion (Misc queries) 2 March 28th 06 07:17 AM
adding new columns sheet with external data John New Users to Excel 0 September 23rd 05 08:00 PM
refresh external data on a protected sheet ajf Excel Discussion (Misc queries) 0 March 11th 05 09:01 AM


All times are GMT +1. The time now is 10:35 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"