ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Evaluating columns based on criteria (https://www.excelbanter.com/excel-programming/356211-evaluating-columns-based-criteria.html)

[email protected]

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


Don Guillett

Evaluating columns based on criteria
 
try
mycell_Fruit = .Range(.cells(1,1),.cells(rows.count,1).End(xlup))


mycell_Fruit = .Range(.cells(1,1),.cells(rows.count.End(xlup),1))


--
Don Guillett
SalesAid Software

wrote in message
oups.com...
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




Tom Ogilvy

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



[email protected]

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.


Don Guillett

Evaluating columns based on criteria
 
mybad

--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
try
mycell_Fruit = .Range(.cells(1,1),.cells(rows.count,1).End(xlup))


mycell_Fruit = .Range(.cells(1,1),.cells(rows.count.End(xlup),1))


--
Don Guillett
SalesAid Software

wrote in message
oups.com...
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







All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com