![]() |
Referencing cells on non-active sheets
Is there a way to reference a cell on a non-active sheet, without first
activating or selecting that sheet? I'm writing code to compare 2 near-identical tables and copy the differences into a summary table. I'm finding that jumping back and forth between the two tables takes quite a lot of time (when it's done for hundred's of rows with ~20 columns). Is there a way for me to reference the cells on each sheet without activating them? The cells to be compared are in identical places, just on different sheets. For example: If Worksheet(1).Range(R,C).Value < Worksheet(2).Range(R,C).Value Then ... Is this possible? Thanks, KellyB |
Referencing cells on non-active sheets
If Worksheet(1).Cells(R,C).Value < Worksheet(2).Cells(R,C).Value Then
You almost had it. -- Regards, Tom Ogilvy "KellyB" wrote in message ... Is there a way to reference a cell on a non-active sheet, without first activating or selecting that sheet? I'm writing code to compare 2 near-identical tables and copy the differences into a summary table. I'm finding that jumping back and forth between the two tables takes quite a lot of time (when it's done for hundred's of rows with ~20 columns). Is there a way for me to reference the cells on each sheet without activating them? The cells to be compared are in identical places, just on different sheets. For example: If Worksheet(1).Range(R,C).Value < Worksheet(2).Range(R,C).Value Then ... Is this possible? Thanks, KellyB |
Referencing cells on non-active sheets
That does work. I was using the Range(R,C) property before and it wasn't
working. Not sure why. The Cells property does work. Any info on why this is? Thank. "Tom Ogilvy" wrote: If Worksheet(1).Cells(R,C).Value < Worksheet(2).Cells(R,C).Value Then You almost had it. -- Regards, Tom Ogilvy "KellyB" wrote in message ... Is there a way to reference a cell on a non-active sheet, without first activating or selecting that sheet? I'm writing code to compare 2 near-identical tables and copy the differences into a summary table. I'm finding that jumping back and forth between the two tables takes quite a lot of time (when it's done for hundred's of rows with ~20 columns). Is there a way for me to reference the cells on each sheet without activating them? The cells to be compared are in identical places, just on different sheets. For example: If Worksheet(1).Range(R,C).Value < Worksheet(2).Range(R,C).Value Then ... Is this possible? Thanks, KellyB |
Referencing cells on non-active sheets
Range will only accept multiple arguments if they are ranges or can be seen
as ranges. Range("A1").Address or Range("A1","B2").Address Range doesn't accept row/column as separate arguments. That is why we have CELL. -- Regards, Tom Ogilvy "KellyB" wrote in message ... That does work. I was using the Range(R,C) property before and it wasn't working. Not sure why. The Cells property does work. Any info on why this is? Thank. "Tom Ogilvy" wrote: If Worksheet(1).Cells(R,C).Value < Worksheet(2).Cells(R,C).Value Then You almost had it. -- Regards, Tom Ogilvy "KellyB" wrote in message ... Is there a way to reference a cell on a non-active sheet, without first activating or selecting that sheet? I'm writing code to compare 2 near-identical tables and copy the differences into a summary table. I'm finding that jumping back and forth between the two tables takes quite a lot of time (when it's done for hundred's of rows with ~20 columns). Is there a way for me to reference the cells on each sheet without activating them? The cells to be compared are in identical places, just on different sheets. For example: If Worksheet(1).Range(R,C).Value < Worksheet(2).Range(R,C).Value Then .... Is this possible? Thanks, KellyB |
All times are GMT +1. The time now is 12:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com