View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] mike.wilson8@comcast.net is offline
external usenet poster
 
Posts: 20
Default Evaluating criteria within certain columns

I'm trying to evaluate criteria within certain columns and if ALL the
data in the columns match against Sheet1 then input a value in Column
E. There can be nulls in the columns, row 4 for ex. My code below
doesn't seem to be working

Ex
Column E Column F Column G Column H Column Column J
1 Fruit Apple Bananan Orange Apple Orange
2 Steak Bananana
3 Fruit Orange
4 Fruit Apple
etc


Sheet 1
Column A
1 Fruit
2 Apple
3 Bananana
4 Orange
5 Peach
etc


lastrow = Cells(Rows.Count, 3).End(xlUp).Row

Dim mycell_Fruit As Range


For i = lastrow To 1 Step -1


For Each mycell_Fruit In
Sheets("Sheet1").Range("A1:A100").Cells.SpecialCel ls(xlCellTypeConstants)

If Cells(i, "F").Value = mycell_Fruit And Cells(i, "G").Value =
mycell_Fruit And Cells
(i, "H").Value = mycell_Fruit And Cells(i, "I").Value =
mycell_FruitAnd Cells(i, "J").Value =
mycell_Fruit Then

Cells(i, "E").Value = Sheets("Sheet1").Range("A1")

End If

Next mycell_Fruit

Next