Google Answers Logo
View Question
 
Q: Excel Automation of Cell Validation ( No Answer,   1 Comment )
Question  
Subject: Excel Automation of Cell Validation
Category: Computers > Programming
Asked by: prg-ga
List Price: $10.00
Posted: 07 Aug 2002 02:12 PDT
Expires: 06 Sep 2002 02:12 PDT
Question ID: 51672
I have an Excel worksheet on a web page (using the OBJECT tag). I can
use VBscript to automate data loading into the sheet. I want to
specify that a cell (or range of cells) can only accept values from a
defined list of values (i.e. standard list validation, displaying as a
drop-down list box). How can I specify my list validation for specific
cells using VBScript?
Is it possible to define the list so that the list box displays text
values but stores corresponding numeric key values (as you can do for
a HTML select tag)?
Answer  
There is no answer at this time.

Comments  
Subject: Re: Excel Automation of Cell Validation
From: chidam-ga on 04 Sep 2002 00:54 PDT
 
For a cell in Excel, you can set the validation rules thru the Menu
option Data->validation. Here is the vb macro.

    With Selection.Validation
        .Delete
        .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
        xlBetween, Formula1:="1,2,3"
        .IgnoreBlank = True
        .InCellDropdown = True
        .InputTitle = ""
        .ErrorTitle = "Error"
        .InputMessage = ""
        .ErrorMessage = "Only Numeric values can be entered"
        .ShowInput = True
        .ShowError = True
    End With

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy