Ask Experts Questions for FREE Help !
Ask
    jakester's Avatar
    jakester Posts: 582, Reputation: 165
    Senior Member
     
    #1

    Dec 3, 2009, 12:55 PM
    VBA function for Date
    Ok, here's my problem. I am trying to concatenate a Chart Title with a date in the MMM-YY format. I have to create a Chart in excel each month. If I create the chart in December, it would be for November's data.

    I can't figure out how to concatenate "Clinical Utilization: " & DateAdd("M",-1,Date)

    It would be nice if I could get the date format to be MMM-YY so that the Chart Title reads:

    Clinical Utilization: Nov-09

    Is this possible?


    Jake
    Perito's Avatar
    Perito Posts: 3,139, Reputation: 150
    Ultra Member
     
    #2

    Dec 3, 2009, 01:43 PM

    I think you're confusing your "types". DateAdd returns a variant, and not a string.

    I suggest you do it this way.

    Dim tDate as date
    tDate = DateAdd("M", -1, Date) ' tDate is one month ago.

    Dim S As String
    S = "Clinical Utilization: " & Format(tDate, "MMM-YY")

    The value of S will be "Clinical Utilization: Nov-09"

    Of course, you don't need the "S" variable. Just shove into whatever cell you wish. But, you can use it, and then put it in the cell:

    Cells(1,1) = S

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search


Check out some similar questions!

How do I convert non-date string to a Date? [ 1 Answers ]

Hi - Okay, so here's my issue. I have a non-date string that I'd like to convert to a date format. This is what my non-date string looks like: 2009-01 and 2009-02, etc. I'd like to convert that to Jan-2009 or 01/09 under the date format. Can I do this?

The result of increasing and decreasing function on the composite function [ 6 Answers ]

I was asked to prove the result of increasing and decreasing function on the composite function... prove that: 1- if f(X) inc & g(X) inc, foG inc 2-if F(X) inc & G(X) dec, foG dec 3- if F(X) dec & G(X) inc, fog dec 4- if f(X) dec & G(X) dec, fog inc please help me in that

Call I have my court date canceled and do it on a later date [ 1 Answers ]

I have a court date for Oct 20 for a scheduling conference for a credit card debt. I was served a summons to file an answer and I did in a timely manner then I received a Notice of Hearing that says the case is scheduled for Scheduling Conference. Can I do anything at this point. I had previously...

To-date total based on current date [ 1 Answers ]

:confused: I am trying to create a forumula that will give a cumulative or "to-date" total that will exclude future months from the total. i.e. ithe point in time is August and I need to show a to-date number Through August only even though September and October are included in The...

F-1 to H-1, what's the start date of H-1? Should be approval date or visa issue day? [ 3 Answers ]

As I mention before, I changed from F-1 to H-1 last year. I got my H-1 status in Feb 2004, but I went to my home country to get the H-1 visa stamp in August 2004. So I would like to know for counting my H-1 status, is it the date that USCIS (the Immigration) approved (which is Feb 1st), or the...


View more questions Search