Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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






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
Referencing an active cell's content from another sheet. emon Excel Worksheet Functions 2 November 12th 08 05:54 PM
Referencing cell in active row pskwaak Excel Worksheet Functions 1 March 17th 07 11:49 PM
referencing active cell works in a sub but not in a custom function RITCHI Excel Worksheet Functions 2 January 14th 07 10:21 AM
referencing active cell works in a sub but not in a custom function RITCHI Excel Worksheet Functions 1 January 14th 07 12:22 AM
In 3 active sheets in wkbk, determine& display the # of sheets that have data wrpalmer Excel Discussion (Misc queries) 1 November 4th 05 02:01 PM


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