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

Hi Rick,

wrong quotes around contents

--
Kind regards,

Niek Otten

"Rick in NS" .(donotspam) wrote in message
...
The modifications to the code based on both recommendations results in a
run-time error of 1004. Debug drop me into the line of code.



ActiveCell.Formula = "=TEXT(B5,""mm-yy-dd"")&"","" &
Cell('contents',RC[3])
& """
--
Rick in N S


"Niek Otten" wrote:

Hi Rick,

Two things: the quotes around "contents" are of the wrong type and you
did
not translate the D5 address to a R1C1 address

--
Kind regards,

Niek Otten

"Rick in NS" .(donotspam) wrote in message
...
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