Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Use "Data Validation" after data are entered

Hello,

I have two xls files: file1.xls and file2.xls

1. File1.xls has been filled by a user via a data base thanks to VB.NET
code. At that level, let's suppose he doesn't know our specific constraints.
2. Each column of file2.xls is associated with "Data Validation" constraints.

I would like to use "Data Validation" of file2.xls to check file1.xls

Is it possible to check by program (via VB code ) if the content of cell
"A1" of file1.xls is OK according "Data Validation" defined in the cell "A1"
of file2.xls (after file1.xls has been fully filled)?

Thank you

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Use "Data Validation" after data are entered

Phillippe,

It would be a whole lot easier to do the validation solely through VBA. To
start, you would need to know each column's validation requirements.

Then you could use code like this to flag the bad cells with red
backgrounds:

Sub TryNow()
Dim myCell As Range
Dim myCol As Range

Cells.Interior.ColorIndex = xlNone

For Each myCol In ActiveSheet.UsedRange.Columns
If myCol.Column = 1 Then
For Each myCell In myCol.Cells
'This is the data validation for column A
If myCell.Value 100 Or myCell.Value < 0 Then
myCell.Interior.ColorIndex = 3
End If
Next myCell
End If
If myCol.Column = 2 Then
For Each myCell In myCol.Cells
'This is the validation for column B
If myCell.Value 120 Or myCell.Value < -10 Then
myCell.Interior.ColorIndex = 3
End If
Next myCell
End If
Next myCol

End Sub

HTH,
Bernie
MS Excel MVP

"Philippe TEIRUH" wrote in
message ...
Hello,

I have two xls files: file1.xls and file2.xls

1. File1.xls has been filled by a user via a data base thanks to VB.NET
code. At that level, let's suppose he doesn't know our specific

constraints.
2. Each column of file2.xls is associated with "Data Validation"

constraints.

I would like to use "Data Validation" of file2.xls to check file1.xls

Is it possible to check by program (via VB code ) if the content of cell
"A1" of file1.xls is OK according "Data Validation" defined in the cell

"A1"
of file2.xls (after file1.xls has been fully filled)?

Thank you



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
need to build a "form" that dumps data entered into another worksh ccreed61 Excel Discussion (Misc queries) 1 October 29th 08 12:01 AM
Calculation Using "Most Current Data Entered" igotboost Excel Worksheet Functions 7 June 18th 08 09:01 PM
Data Validation - List - Data "NOT BETWEEN" - Source Possible? Duke2U Excel Worksheet Functions 1 June 23rd 06 12:29 PM
How can "data validation" be enforced in calculated cells NirA Excel Worksheet Functions 1 March 24th 06 06:13 PM
Adding "New" "Insert" "Delete" into a workbook to change from data 1 to data 2 etc Bob Reynolds[_2_] Excel Programming 0 March 4th 04 08:52 PM


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