+ Reply to Thread
Results 1 to 3 of 3

create function that returns a value based on current month

  1. #1
    Registered User
    Join Date
    07-01-2018
    Location
    Houston, TX.
    MS-Off Ver
    Office 365
    Posts
    93

    Post create function that returns a value based on current month

    my workbook has 12 sheets in it named abbreviated month name, on each sheet is a button that loads a user form,
    I have the this code in a FormShow Sub, it works, I would like to clean up the sub and using a function might be a way to do this. would like help on how to go about it.

    Please Login or Register  to view this content.
    would like a simple call in place of what I have, maybe

    Please Login or Register  to view this content.
    could this be placed in my module that is my declares module ?

    Thanks in advance
    Last edited by dad812; 01-16-2019 at 10:08 AM. Reason: more information

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: create function that returns a value based on current month

    I think you have typo, should Aug not be 46?

    At any rate you don't need separate function/sub for this. You can simply calculate 6 + 5 * Month#.

    Something like...
    Please Login or Register  to view this content.
    Note: I'd recommend adding simple error trap before "dt =" line. Like... "On Error GoTo ErrHandle:" and at end of sub, add something like below.
    Please Login or Register  to view this content.
    Last edited by CK76; 01-16-2019 at 10:20 AM. Reason: Typo, and see Notes.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    07-01-2018
    Location
    Houston, TX.
    MS-Off Ver
    Office 365
    Posts
    93

    Re: create function that returns a value based on current month

    much better than what I had previous, and thanks for the typo catch... Aug. would have been "Fun"
    Last edited by dad812; 01-16-2019 at 10:34 AM. Reason: more information

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Month Function When Nested inside Text returns incorrect Month Serial Number
    By ibuhary in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-06-2018, 04:12 AM
  2. [SOLVED] No of Days Passed in current month based on =Today() Function
    By kskhan1105 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-06-2017, 10:16 AM
  3. Current Month SUMIFS returns ) value?
    By mfwilli in forum Excel General
    Replies: 1
    Last Post: 02-13-2017, 02:46 PM
  4. [SOLVED] Determine work days in current month or next month based on day of the month
    By sbrnard in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-29-2014, 05:14 PM
  5. [SOLVED] Pick a cell containing current month actulas based what the current month is.
    By vanbasten007 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-10-2014, 01:17 AM
  6. Replies: 6
    Last Post: 01-09-2006, 04:55 AM
  7. [SOLVED] HELP - need to returns the current number of past month this year and ...
    By elz64 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-06-2005, 10:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1