VBA help

ekrom8

New Member
Joined
Mar 12, 2018
Messages
3
Cell A1 currently says "Medicare 2018 Brand/Generic File Date 2-1-2018 to 2-28-2018". I am looking for a code that will replace this as follows: "Medicare [Current Month] [Current Year] Brand/Generic File [1st Day of Current Month] to [Last Day of Current Month].

Example: Medicare March 2018 Brand Generic File 3-1-2018 to 3-30-2018.

I tried Googling and came up with nothing. This would save me a lot of time not having to update many cells with the current month and dates. Please help. Thanks in advance!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I tried Googling and came up with nothing

Try googling "Date & Time functions in Excel" or click in Excel on the "Date & Time" functions in the Formulas Tab.. or use the inbuilt Excel Help on date and time functions...

I'll help you get started but you need to do some reading yourself on basic Excel functions (like the "&" below to join Strings together plus learn about Dates and Times etc)...

Also, beware that if you do end up using a formula , such as
Code:
="Medicare for " & TEXT(NOW(),"mmm-yyyy") &" Brand Generic File" etc

or

="Medicare for " & MONTH(NOW()) & "-" & YEAR(NOW()) &" Brand Generic File" etc
..then the value in Cell A1 will change whenever you open the Workbook.

This means that if you prepare the Spreadsheet in March it will say what you want, but when you open it next month to Check something it will say "April" above data for March.

You might like to consider pasting the VALUE from the formula result into the Cells before saving a COPY of the spreadsheet each month.

Cheers,
Warren K.
 
Upvote 0
Thank you so much for the help. I had no clue about these functions at the time. I finished up my project today.
 
Upvote 0
Great ekrom8

Sometimes VBA is the ONLY solution, and some times its not. The thing is, why reinvent the toster when we alrwady have a good working model 8-; It is said that the worksheet functions are more optimized than VBA.

Good luck, and come back for some more greathelp.
 
Upvote 0

Forum statistics

Threads
1,223,157
Messages
6,170,418
Members
452,325
Latest member
BlahQz

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