View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Activecell.FormulaR1C1 Versus ActiveSheet.cells(column, row)

Ashish,

Apart from the syntax of the former being wrong, they are basically the
same, with one big proviso. The first does a select, which means that the
sheet being worked upon has to be active and visible so that the screen can
be re-painted.

So 1 does a select and then writes to the selected cell.

The second writes directly to a nominated cell, no selection involved.

As for the memory issue, I do not find this problem in my testing. Both
times Excel clears correctly. Is this being done through automation?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Ashish Shridharan" wrote in message
...
Hi
Can anyone explain the difference between the following two methodologies

of accessing and writing data to a cell in an excel sheet ?

1. using
range(column : row).select
activecell.formular1c1 = <data OR activecell.text

= <data

2. Using
activesheet.cells(column, row) = <data


I have actually seen an application in the last couple of days that was

using option 2 to write data to the excel sheet. The only problem was that
Excel would continue to remain in memory even though QUIT, setting to
nothing was being done on the excel variable instance.

However, when i change the code to use Option 1, the excel object was

removed from memory.

Didnt make sense to me at all. Was hoping that someone could explain this

to me.

Thanks

Ashish Shridharan