+ Reply to Thread
Results 1 to 17 of 17

Macro to change month's number in a formula

  1. #1
    Registered User
    Join Date
    09-06-2006
    Posts
    17

    Smile Macro to change month's number in a formula

    Hi,
    I have 2 columns in a a sheet, some cells in the second (not all cells) contains the current month's number (it comes after the multiplication sign in those formulas).
    i need a macro that allows me automatically to advance the month's number each month in this formula (just the month's number), if it's 1 advance to 2, 2 to 3, 12 to 1 etc....
    see a example of my formulas below, the formulas are in colomn B, the month number is whatever comes after * (multiplication sign).
    example:
    5500/11*12
    12000*12+55000
    =A2/11*12+55000
    i'm new in macros, i really appreciate any ideas (i'm using excel 97).
    thanks.

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    You do not need a macro for that ...
    Just change your formula to
    Please Login or Register  to view this content.
    HTH
    Carim


    Top Excel Links

  3. #3
    Registered User
    Join Date
    09-06-2006
    Posts
    17

    yes but?

    thanks Karim for your help, but it's not exactly what i want.
    i wanna keep these formulas as they are till i change them some day during the month, i don't want excel to automatically change them at the begining of the month, but when i wanna change them, and so on each month.

  4. #4
    Registered User
    Join Date
    09-06-2006
    Posts
    17

    or...

    or eventually put your formula Carim (Month(today())), but is there anyway to not activate the changes inside the cells till i want that.
    is it feasable what i'm saying or it's just dreaming.
    thanks for any help!

  5. #5
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    What is the triggering factor ...???

  6. #6
    Registered User
    Join Date
    09-06-2006
    Posts
    17
    the triggering factor it's when i wanna change them. it's a sheet that i dive it monthly to the direction, durind the month for the month before.
    example i'm in mid february, i wanna change 12 (dec.) to 1 (jan.), in all the cells that contains 12 in that column (B).

  7. #7
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Does the following help ...
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    09-06-2006
    Posts
    17
    i guess it might help, but i'm not familiar with macros, so i copied and pasted your code it gave error 1004, method range of object global failed.
    what did i have to put into my range? then is there anyway to not doing any changes to the macros every month meaning including a part that advances whatever i wanna change month by month.
    thanks carim for your help

  9. #9
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Sorry I did not properly explained ...
    In cell D1 type the number of the month used in your formulas, say 12
    In cell D2 type the number of the month you now want in your formulas, say 1

    then run macro ...

  10. #10
    Registered User
    Join Date
    09-06-2006
    Posts
    17
    thanks for your help Carim,
    we're almost done, but just a tiny little thing, it's i wanna just change the number that comes after the multiplication sign in case we have the same number twice or more in the same cell.
    example: 52000/12*12+15000, just change the 12 that's after *.

  11. #11
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Adjust the macro as follows ...

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    09-06-2006
    Posts
    17
    it didn't work out Carim,
    examples:for: 600000/12*12 it gave *11*11
    for: 97000/12*12+55100 it gave *11*11+55100
    for: 12000/12*12 it gave *11*11*11

  13. #13
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Sorry for that ...
    Let's us try following ...it should be Ok ...
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    09-06-2006
    Posts
    17
    it' still the same result Carim

  15. #15
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Finally ...

    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    09-06-2006
    Posts
    17

    thanks carim

    it works Carim.
    Thanks a lot for your help, and thanks for everybody in this forum.

  17. #17
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Glad it finally fixed your problem

    Thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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