ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can a variable workbook be embedded into an Excel funtion? (https://www.excelbanter.com/excel-programming/274134-re-can-variable-workbook-embedded-into-excel-funtion.html)

Tom Ogilvy

Can a variable workbook be embedded into an Excel funtion?
 
set rng1 = workbooks("Book1.xls").Worksheets("Sheet1").range( "A1:B10")
set rng1 = workbooks("Book2.xls").Worksheets("sheet3").Range( "C1:C10")

res = Evaluate("Not(or(" & rng1.address(0,0,xlA1,true) & "<" _
& rng2.Address(0,0,xlA1,true) & "))")

--
Regards,
Tom Ogilvy


"JeffFinnan" wrote in message
...
Previously, I had queried about comparing ranges as to whether they were
exactly the same as each other

Tom Ogilvy had suggested using something like this:


? Evaluate("=NOT(OR(A1:B10<C1:D10))")
False

Range("C1:D10").Value = Range("A1:B10").Value
? Evaluate("=NOT(OR(A1:B10<C1:D10))")
True The question I have now is how can I use a variable name or some

separate
worksheet references for the ranges within the Excel function? By this I

mean
each range could be a variable workbook and work sheet as well as a

variable
range.

Thanks,
Jeff




JeffFinnan

Can a variable workbook be embedded into an Excel funtion?
 
Tom,

This works fine. What do the specifications with the () signify below?

-- (0,0,xlA1,true)


======================================

set rng1 = workbooks("Book1.xls").Worksheets("Sheet1").range( "A1:B10")
set rng1 = workbooks("Book2.xls").Worksheets("sheet3").Range( "C1:C10")

res = Evaluate("Not(or(" & rng1.address(0,0,xlA1,true) & "<" _
& rng2.Address(0,0,xlA1,true) & "))")





All times are GMT +1. The time now is 05:35 AM.

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