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 columns based on criteria

Can someone help with the code below and see what needs to be
changed/added? 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) ). This code was
posted to me yesterday from .

Thank you


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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Evaluating columns based on criteria

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

--
Regards,
Tom Ogilvyl

" wrote:

Can someone help with the code below and see what needs to be
changed/added? 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) ). This code was
posted to me yesterday from .

Thank you


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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Evaluating columns based on criteria

Thank you very much..it seems to be working like a charm. This code is
so quick and dirty vs. doing a long IF statement for each column. This
will be tucked away for future projects.



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 mulitple criteria with COUNTIF JRJ Excel Worksheet Functions 4 March 12th 08 10:43 PM
Evaluating Equations Based on Selection !! monir Excel Worksheet Functions 3 February 25th 08 10:49 PM
Evaluating criteria within certain columns [email protected] Excel Programming 2 March 15th 06 10:00 PM
get a total based on criteria in two columns rar Excel Worksheet Functions 2 November 22nd 05 02:24 PM
Sum based on criteria in rows and columns EstherJ Excel Discussion (Misc queries) 1 November 1st 05 10:28 AM


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