View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Insert value of formula into cell

Hi,

Range("J7").Value = "=VLookup(Month(A4), Data!A1:B14, 2, False)& "" "" &
YEAR(A4)"

HTH

"Matt Lunn" wrote:

Hi,

If you want to use VLookup (or any worksheet formula) in your code you need
to use the WorksheetFunction object

e.g,

Range("J7").Value = WorksheetFunction.VLookup( <Arguments go here)

HTH,
Matt



"Bill" wrote:

The following code does not work. I am trying to put the result of the
formula into cell J7. Nothing happens.

Range("J7").Value = "VLookup(Month(A4), Data!A1:B14, 2, False)& " " & YEAR(A4)

Thanks
Bill