ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Follow-up Question for Dave Peterson (https://www.excelbanter.com/excel-discussion-misc-queries/178166-follow-up-question-dave-peterson.html)

Roger

Follow-up Question for Dave Peterson
 
Good Morning Dave,

I'm wondering if it's possible to add an additional condition to the Match
Row for the Sheet1 look-up?

After the Sheet1 Match is found in Sheet2 Column A, I'm also looking to add
a condition so that Sheet2 Column D is < "" before returning the Match value
to the noted sheet location.

Is that a possibility?

Thank you for your review once again - Roger


Dim WkbkARng as range
dim WkbkBRng as range
dim myCell as range
dim res as variant 'could be a number or an error

set wkbkARng =
workbooks("workbookA.xls").worksheets("sheet1").ra nge("E2:e100")
set wkbkBRng =
workbooks("workbookB.xls").worksheets("sheet2").ra nge("a2:a100") << looking
for match in same row and column D to be < ""

for each mycell in wkbkarng.cells
res = application.match(mycell.value,wkbkbrng,0)
if iserror(res) then

else
mycell.offset(0,1).copy _
destination:=wkbkbrng(res).offset(0,1)

end if
next mycell

Dave Peterson

Follow-up Question for Dave Peterson
 
I'm not sure what
< ""
means

But you could add the condition he

for each mycell in wkbkarng.cells
res = application.match(mycell.value,wkbkbrng,0)
if iserror(res) then
'do nothing
else
'change this to what you mean
if wkbkbrng(res).offset(0,1).value < 9999 then
'do the work
mycell.offset(0,1).copy _
destination:=wkbkbrng(res).offset(0,1)
else
'skip it
end if
end if
next mycell

Roger wrote:

Good Morning Dave,

I'm wondering if it's possible to add an additional condition to the Match
Row for the Sheet1 look-up?

After the Sheet1 Match is found in Sheet2 Column A, I'm also looking to add
a condition so that Sheet2 Column D is < "" before returning the Match value
to the noted sheet location.

Is that a possibility?

Thank you for your review once again - Roger

Dim WkbkARng as range
dim WkbkBRng as range
dim myCell as range
dim res as variant 'could be a number or an error

set wkbkARng =
workbooks("workbookA.xls").worksheets("sheet1").ra nge("E2:e100")
set wkbkBRng =
workbooks("workbookB.xls").worksheets("sheet2").ra nge("a2:a100") << looking
for match in same row and column D to be < ""

for each mycell in wkbkarng.cells
res = application.match(mycell.value,wkbkbrng,0)
if iserror(res) then

else
mycell.offset(0,1).copy _
destination:=wkbkbrng(res).offset(0,1)

end if
next mycell


--

Dave Peterson

Roger

Follow-up Question for Dave Peterson
 
Thank you so much Dave - exactly what I needed and works great.

<"" meant greater than nothing, but I should have actually written it out.

Thanks again and you're the best - Roger

"Dave Peterson" wrote:

I'm not sure what
< ""
means

But you could add the condition he

for each mycell in wkbkarng.cells
res = application.match(mycell.value,wkbkbrng,0)
if iserror(res) then
'do nothing
else
'change this to what you mean
if wkbkbrng(res).offset(0,1).value < 9999 then
'do the work
mycell.offset(0,1).copy _
destination:=wkbkbrng(res).offset(0,1)
else
'skip it
end if
end if
next mycell

Roger wrote:

Good Morning Dave,

I'm wondering if it's possible to add an additional condition to the Match
Row for the Sheet1 look-up?

After the Sheet1 Match is found in Sheet2 Column A, I'm also looking to add
a condition so that Sheet2 Column D is < "" before returning the Match value
to the noted sheet location.

Is that a possibility?

Thank you for your review once again - Roger

Dim WkbkARng as range
dim WkbkBRng as range
dim myCell as range
dim res as variant 'could be a number or an error

set wkbkARng =
workbooks("workbookA.xls").worksheets("sheet1").ra nge("E2:e100")
set wkbkBRng =
workbooks("workbookB.xls").worksheets("sheet2").ra nge("a2:a100") << looking
for match in same row and column D to be < ""

for each mycell in wkbkarng.cells
res = application.match(mycell.value,wkbkbrng,0)
if iserror(res) then

else
mycell.offset(0,1).copy _
destination:=wkbkbrng(res).offset(0,1)

end if
next mycell


--

Dave Peterson


Dave Peterson

Follow-up Question for Dave Peterson
 
I'd use either:
if wkbkbrng(res).offset(0,1).value < "" then
or even
if trim(wkbkbrng(res).offset(0,1).value) < "" then

Roger wrote:

Thank you so much Dave - exactly what I needed and works great.

<"" meant greater than nothing, but I should have actually written it out.

Thanks again and you're the best - Roger

"Dave Peterson" wrote:

I'm not sure what
< ""
means

But you could add the condition he

for each mycell in wkbkarng.cells
res = application.match(mycell.value,wkbkbrng,0)
if iserror(res) then
'do nothing
else
'change this to what you mean
if wkbkbrng(res).offset(0,1).value < 9999 then
'do the work
mycell.offset(0,1).copy _
destination:=wkbkbrng(res).offset(0,1)
else
'skip it
end if
end if
next mycell

Roger wrote:

Good Morning Dave,

I'm wondering if it's possible to add an additional condition to the Match
Row for the Sheet1 look-up?

After the Sheet1 Match is found in Sheet2 Column A, I'm also looking to add
a condition so that Sheet2 Column D is < "" before returning the Match value
to the noted sheet location.

Is that a possibility?

Thank you for your review once again - Roger

Dim WkbkARng as range
dim WkbkBRng as range
dim myCell as range
dim res as variant 'could be a number or an error

set wkbkARng =
workbooks("workbookA.xls").worksheets("sheet1").ra nge("E2:e100")
set wkbkBRng =
workbooks("workbookB.xls").worksheets("sheet2").ra nge("a2:a100") << looking
for match in same row and column D to be < ""

for each mycell in wkbkarng.cells
res = application.match(mycell.value,wkbkbrng,0)
if iserror(res) then

else
mycell.offset(0,1).copy _
destination:=wkbkbrng(res).offset(0,1)

end if
next mycell


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 10:39 PM.

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