+ Reply to Thread
Results 1 to 4 of 4

VBA script to override current code 'when needed'

  1. #1
    Registered User
    Join Date
    11-04-2010
    Location
    Illinois
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    86

    VBA script to override current code 'when needed'

    Hello Excel Forum. This is my issue:
    A group in my department utilizes a spreadsheet that was designed by a pretty bright VBA programmer who no longer works at my jobsite (and currently is not available for contact). The code basically runs an automated report daily based off data given from other departments. I included a dummy worksheet that shows where this data is and how it manipulates it but this is what I need to happen. The code below is what I think corresponds to applying what the original programmer called 'factors' based on if it was a weekday or a weekend.

    However, what I need to happen is almost for an additional line or lines of code to override this portion of code and apply factors of 0.1 or user specified factors and an associated button that can turn on this 'overriding' code at the users' discretion. It doesn't necessarily have to be a button but just the macro that can achieve this task. Bolded portion of code is what I believe will need to be 'emulated' in order to create this overriding code. The important thing is I absolutely do not want to just delete the current code below or even modify it, I just would like additional code to override that portion at user discretion. If you have any more questions, please let me know. As always, I will +rep, give credit where credit is due, etc for anyone that can assist me with this b/c I need to accomplish this very quickly.



    Thanks,
    HP RodNuclear
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: VBA script to override current code 'when needed'

    hi HP RodNuclear, if I understoof you right, the main question is to provide sort of interaction to code by option for user either to proceed with default value of 0.1 for any day of the week or to set a different one.

    Question: 0.1 will be one factor for any weekday or you want to be able to set separate values for days 6,7 and the rest?

  3. #3
    Registered User
    Join Date
    11-04-2010
    Location
    Illinois
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    86

    Re: VBA script to override current code 'when needed'

    Watersev,
    I apologize it took me so long to get back to you but this is what I would like:

    The default setting currently is what you see in the code I posted above i.e. for weekdays (Monday-Friday), it assigns a factors of 0.8 and 0.7. However, on the weekend it assigns factors of 0.2.

    What I would like though is for a code to be generated to override this code IF the user wishes and assign a user defined factor for everyday of the week (Monday-Saturday).

    In my non programming terms, this is how I logically see the code working out:

    a) user opens excel spreadsheet
    b) user looks at list of macros from tools menu and looks at a macro called 'factor override' (or something like that) and presses run
    c) when this code runs, it asks the user what factor it wishes to use and the user can put in any factor they would like (a number of course).
    d) optional: if you are up to it, you could add in some code that could assign separate values to days 6 and 7 b/c this may come in handy down the road. It also could be user defined as far as length of time i.e. code could ask for how many days or weeks does the override need to run. I'm a little hesitant on this one though b/c the override code needs to be able to be turned off at user request. I think that is the most usefulness of a macro such as this.

    Hopefully this clears it up and thank you Watersev for the reply.

  4. #4
    Registered User
    Join Date
    11-04-2010
    Location
    Illinois
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    86

    Re: VBA script to override current code 'when needed'

    Watersev, any progress on this or anyone else have any ideas?

    Thnx,
    HP Rod

+ 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