Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to add validation by VBA

I want to set validation of a cell from a list of value in another exce
file. I know that I can do from Data Menu - Validation. However,
want to do it by writing VBA code.

Example:
In A.xls, cell A1 = Apple
cell A2 = Orange
cell A3 = Pear
cell A4 = Banana

Then in B.xls, I want to set cell D3 can have the value only from th
above list,

How can I do so?

Thx a lot

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default How to add validation by VBA

You cannot do this directly since datavalidation does not accept it.
HOWEVER, you can name the range in the active workbook that refers to the
range in the source workbook.
insertnamedefinename it mylistin the refers to box type in
'=[20010112.xls]Data!$A$14:$A$19
now in the data validation cell use LIST and type in =mylist
voila!
--
Don Guillett
SalesAid Software

"michelle_ho " wrote in message
...
I want to set validation of a cell from a list of value in another excel
file. I know that I can do from Data Menu - Validation. However, I
want to do it by writing VBA code.

Example:
In A.xls, cell A1 = Apple
cell A2 = Orange
cell A3 = Pear
cell A4 = Banana

Then in B.xls, I want to set cell D3 can have the value only from the
above list,

How can I do so?

Thx a lot!


---
Message posted from
http://www.ExcelForum.com/



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
Validation Data using Validation Table cell range..... Dermot Excel Discussion (Misc queries) 16 January 5th 10 09:35 PM
How do I get a Data validation list to select another validation l langston35 New Users to Excel 1 September 28th 09 08:38 AM
data validation invalid in dynamic validation list ilia Excel Discussion (Misc queries) 0 November 7th 06 12:54 PM
data validation invalid in dynamic validation list ilia Excel Worksheet Functions 0 November 7th 06 12:54 PM
Data validation with validation lists and combo boxs Keith Excel Discussion (Misc queries) 1 October 12th 06 11:08 AM


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