Hi,
I have created the Boolean function below to evaluate if a given cell in an
Excel file contains a formula. I have to process hundreds of excel files and I
want to filter out any
cells that contain formulae.
Now I want to use the isXlsFormula function below when I loop through all the
cells of a sheet, and all sheets of an excel file. For this, it would be very
convenient if I could use the alternative R1C1 excel reference style, instead of
the alphabetic style, as shown below. Is this possible?
library(rcom)
isXlsFormula <- function(cellref="A1") {
excel <- comGetObject("Excel.Application")
sheet <- comGetProperty(excel, "ActiveSheet")
cell <- comGetProperty(sheet, "Range", cellref, cellref)
isformula <- comGetProperty(cell, "hasFormula")
return(isformula)
}
isXlsFormula() # returns TRUE if cell A1 (R1C1) contains a formula, FALSE
otherwise.
Thank you in advance.
Cheers!!
Albert-Jan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public
order, irrigation, roads, a fresh water system, and public health, what have the
Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[[alternative HTML version deleted]]