View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
STEVE BELL STEVE BELL is offline
external usenet poster
 
Posts: 692
Default Insert value of formula into cell

Bll,

My oversight - forgot that you were writing code and didn't get all the
ranges set up for code:
[Note this should be on a single line, but the line continuation _ makes
Excel see it as one line; and you may not need ".Value"]

Range("A4").Value = WorksheetFunction.VLookup(Month(Range("A4")), _
Sheets("Data").Range("A1:B14"), 2, False) & " " & Year(Range("A4"))


Also - (not sure) but it looks like you just want Month Year in A4
If so - you can just format the cell
Range("A4").NumberFormat = "mmmm yyyy"
or
Range("A4").NumberFormat = "mmm yyyy"
--
steveB

Remove "AYN" from email to respond
"Bill" wrote in message
...
Steve & all

Thanks. I would appreciate any additional information you can provide. I
have not been able to get the code with the changes to work.

Bill

"STEVE BELL" wrote:

In code you need to specify ranges as
Range("A4")
so
Month(A4) should be Month(Range("A4")
Data!A1:B14 should be Sheets("Data").Range("A1:B14")
--
steveB

Remove "AYN" from email to respond
"Bill" wrote in message
...
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