Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 31st, 2008, 10:30 AM
Registered User
 
Join Date: Sep 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Adding validation code in excel

In my excel spread sheet I am adding the following code to show a list

Target.Cells.Validation.Add 1, 1 , , , "=$A$1:$A$10"

It gives me the following error message :
Run-time error '1004' :
Application-defined or object-defined error.

I do have data in A1 to A10 cells. I am not sure how to fix this.
Any help is greatly appreciated.

donsls
 
Old November 1st, 2008, 01:37 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

Can you check if the following works for you

Target.Cells.Select
Selection.Validation.Add xlValidateList, 1, xlBetween, "=$A$1:$A$10"

Cheers
Shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help in VBA excel on validation deepunair84296 Excel VBA 2 July 11th, 2008 04:23 PM
Adding Excel Spreadsheet to form jwebb Visual Basic 2005 Basics 2 June 18th, 2007 01:32 PM
Adding to Export Of GridView to Excel rsearing ASP.NET 2.0 Professional 17 January 25th, 2007 02:41 AM
multi validation in excel lucarnold Excel VBA 1 January 22nd, 2007 06:06 AM
running example code from Ch 3 - Form Validation cshu BOOK: Professional Ajax ISBN: 978-0-471-77778-6 0 November 4th, 2006 05:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.