Combine Text and Calculated Results in a single cell

tlc_in_OK

Board Regular
Joined
Jun 27, 2011
Messages
56
I'm trying to combine text with the results of a calculation in a single cell via a macro, and haven't had much luck.

What I need it to look like is "Actual June Data as of 7/05/2011" across merged cells G36:J36. The words "Actual" and "Data as of" are text. The month is derived from another worksheet where the month is indicated by just an integer in a cell, i.e. 6, 8, etc. I've been trying to use "=Choose" with the months to write out the month name, but haven't been able to get that to work like it would by putting it in a cell as a formula. The "7/05/2011" is simply the current date.

I need this to be in a macro because users will be altering data, and I have to keep some statistics of the data before any changes are made.

Any ideas?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Example, using the month number in A1:

="Actual "&CHOOSE(A1,"January","February","March","April","May","June","July","August","September","October","November","December")&" Data as of "&TEXT(TODAY(),"mm/dd/yyyy")
 
Upvote 0
Thanks Andrew, but I keep getting a "sub or function not defined" error on the "Today()" function. . .I thought that was a standard Excel function. Also, since my cell with the month number is on another worksheet, will simply putting in the referenece, i.e Worksheet2!A2 work?
 
Upvote 0
How can you get a "sub or function not defined" error when you enter a formula on a worksheet? TODAY is an in-built Excel function.
 
Upvote 0
That's just it. . .I'm not trying to do this as a formula in a worksheet cell, I'm trying to put the resulting value in the cell via a macro. I'm getting the error when I try to compile.
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,908
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top