View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers
bpeltzer
 
Posts: n/a
Default First attempt at VBA coding problem

The final D5 should read RC[3].
This is one of those that's probably easiest to translate by just turning on
the macro recorder then dropping the formula you want in the cell where you
want it. Then jump into the VB Editor and copy the line of code.
--Bruce

"Rick in NS" wrote:

I have a formula in a cell on a worksheet as follows:


=TEXT(DAY(B5),"00")&"-"&TEXT(MONTH(B5),"00")&"-"&RIGHT(TEXT(YEAR(B5),"00"),2)&"," & CELL("contents",D5)&""

I am attempting to automate entering the formula in a cell with the
following macro code. Obviously I have something wrong with the syntax. Can
anyone identify the error in this code:

ActiveCell.FormulaR1C1 = _

"=TEXT(DAY(RC[1]),""00"")&""-""&TEXT(MONTH(RC[1]),""00"")&""-""&RIGHT(TEXT(YEAR(RC[1]),""00""),2)&"","" & Cell(€ścontents€ť,D5)&"""""

--
Rick in N S