Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Validate data

I have a workbook with 2 sheets. On sheet (1) is the
results of a macro. On sheet(2) is a set of valid values.

I would like to add an edit that compares the results in
Sheet(1) Col A with the valid values on sheet (2).

I was probably going to create a range for the valid
values but I'm looking for a easy way to cycle through
results in Col A sheet (1). I also want to highlight any
invalid value in Col A.

I appreciate any suggestions on how to accomplish this.
Thanks for the help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Validate data

You might try something like the following. Of course you'd have to adjust
how you set the two ranges. This assumes data starts at A1 in each sheet
and is contiguous.

Sub a()
Dim ValidRg As Range
Dim CheckRg As Range
Dim Cell As Range
With Workbooks("Book1").Worksheets("Sheet1") ''has valid entries
Set ValidRg = .Range("A1", .Range("A1").End(xlDown))
End With
With Workbooks("Book2").Worksheets("Sheet1") ''has values to check
Set CheckRg = .Range("A1", .Range("A1").End(xlDown))
End With
For Each Cell In CheckRg
If IsError(Application.Match(Cell.Value, ValidRg, False)) Then
Cell.Font.Bold = True
End If
Next
End Sub


--
Jim Rech
Excel MVP
"JT" wrote in message
...
|I have a workbook with 2 sheets. On sheet (1) is the
| results of a macro. On sheet(2) is a set of valid values.
|
| I would like to add an edit that compares the results in
| Sheet(1) Col A with the valid values on sheet (2).
|
| I was probably going to create a range for the valid
| values but I'm looking for a easy way to cycle through
| results in Col A sheet (1). I also want to highlight any
| invalid value in Col A.
|
| I appreciate any suggestions on how to accomplish this.
| Thanks for the help


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Validate data

Thanks for the help.

-----Original Message-----
You might try something like the following. Of course

you'd have to adjust
how you set the two ranges. This assumes data starts at

A1 in each sheet
and is contiguous.

Sub a()
Dim ValidRg As Range
Dim CheckRg As Range
Dim Cell As Range
With Workbooks("Book1").Worksheets("Sheet1") ''has

valid entries
Set ValidRg = .Range("A1", .Range("A1").End

(xlDown))
End With
With Workbooks("Book2").Worksheets("Sheet1") ''has

values to check
Set CheckRg = .Range("A1", .Range("A1").End

(xlDown))
End With
For Each Cell In CheckRg
If IsError(Application.Match(Cell.Value, ValidRg,

False)) Then
Cell.Font.Bold = True
End If
Next
End Sub


--
Jim Rech
Excel MVP
"JT" wrote in

message
...
|I have a workbook with 2 sheets. On sheet (1) is the
| results of a macro. On sheet(2) is a set of valid

values.
|
| I would like to add an edit that compares the results in
| Sheet(1) Col A with the valid values on sheet (2).
|
| I was probably going to create a range for the valid
| values but I'm looking for a easy way to cycle through
| results in Col A sheet (1). I also want to highlight

any
| invalid value in Col A.
|
| I appreciate any suggestions on how to accomplish this.
| Thanks for the help


.

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
using Vlookup to validate data vinstream Excel Discussion (Misc queries) 3 April 8th 10 09:21 AM
Data/Validate/List BobxxCalgary Excel Worksheet Functions 1 July 31st 08 11:14 PM
Validate Data Message Box Judi Excel Discussion (Misc queries) 2 July 11th 08 11:09 PM
Validate cells have data WendyUK Excel Worksheet Functions 9 August 13th 05 01:33 AM
validate data using code Gareth[_3_] Excel Programming 1 November 27th 03 11:37 PM


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