Activecell.FormulaR1C1 Versus ActiveSheet.cells(column, row)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

H
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).selec
activecell.formular1c1 = <data> OR activecell.text = <data

2. Usin
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

Thank

Ashish Shridharan
 
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 said:
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
= said:
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.
 
Hi Bo

The app is a classic ASP app calling a component that generates the Excel file with the data

I couldnt really think of a co-relation between the two but i did see this happen and Excel did go away the minute i changed the code to a Range.select methodology

Thanks
Ashish
 
Back
Top