LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Programming Validation

Hi,
I used the macro recorder to record the setting up of data validation in
certain cells.
It came up with the following code.

Range("C2:C200").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=INDIRECT(A2&B2)"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = False
.ShowError = False
End With

During the recording process, when I entered the validation formula, I got a
message saying:
The source currently evaluates to an error. Do you wish to continue?
So I clicked 'Yes' and continued.
When I run the macro, it stops at the line:
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=INDIRECT(A2&B2)"
and I get an error message:

Run-time error 1004
Application-defined or object-defined error

Is there any way around this? I want the data validation even though it
currently evaluates to an error.

Regards - Dave.
 
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
Excel 2007-macro programming logic for data validation Derek Megyesi Excel Discussion (Misc queries) 2 February 1st 10 01:34 AM
Excel 2007-programming macros that apply to data validation Derek Megyesi New Users to Excel 1 January 31st 10 10:11 PM
Validation add method fail when programming Excel with VBA John Sherry Excel Programming 3 November 26th 05 06:06 PM
Data Validation Programming pyarb Excel Programming 0 September 2nd 05 03:38 PM
Validation (Drop down list vs simple text length validation) Bob Phillips[_6_] Excel Programming 2 April 27th 04 07:47 PM


All times are GMT +1. The time now is 08:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"