Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Evaluating criteria within certain columns


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

Dim mycell_Fruit As Range
with Worksheets("sheet1")
mycell_Fruit = .Range(.cells(1,1),.cells(rows.count,1).End(xlup))
End with

For i = lastrow To 1 Step -1
bMatch = True
for j = 6 to 10
if not isempty(cells(i,j)) then
res = Application.Match(cells(i,j),mycell_Fruit,0)
if iserror(res) then
bMatch = False
exit for
end if
end if
next
if bMatch then cells(i,"E").value = "Fruit"
Next

--
Regards,
Tom Ogilvy


" wrote:

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Evaluating criteria within certain columns

Tom,

I'm sure this we will work, but I'm getting an Object variable or With
block variable not set error on line -
mycell_Fruit = .Range(.cells(1,1),.cells(rows.count,1).End(xlup))

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
Evaluating division by zero Shams Excel Worksheet Functions 10 April 14th 08 10:24 PM
Evaluating mulitple criteria with COUNTIF JRJ Excel Worksheet Functions 4 March 12th 08 10:43 PM
Pivot table with added columns for evaluating results Ekazakoff Excel Worksheet Functions 5 September 22nd 06 02:56 AM
VBA for Evaluating Integrals brett4098[_3_] Excel Programming 0 November 12th 04 08:42 PM
Evaluating Week No. MahaRaj Excel Programming 8 July 25th 04 02:06 PM


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