+ Reply to Thread
Results 1 to 2 of 2

Pesky #NUM! Error, Writing VBA to move Text based on Drop Down

  1. #1
    Registered User
    Join Date
    06-22-2017
    Location
    CT
    MS-Off Ver
    2016
    Posts
    16

    Pesky #NUM! Error, Writing VBA to move Text based on Drop Down

    I am working on a SS to solve some irritating scheduling problems at work.

    We have three shifts (Mids, Days, Eves) and three squads (A, B, C). Two squads are on at a time, while the other squad is on their "weekend", i.e. when A & B are working, C is off.

    I've created a SS that draws the appropriate workers from the "master pool" and assigns them to the schedule in accordance with their shift and squad. As the number of workers may increase or decrease, I extended the formula throughout the entire "working" field so as not to miss selecting a worker from the "pool". As the calendar progresses, and squads move from working to having a day off, the schedule automatically moves them from "working" to "off".

    Between the "working" and "off" portions of the SS the formula is almost identical. The "working" formula selects workers based on shift and working squad, while the "off" formula selects workers based on the day off schedule and moves them to the "off" section. So if I don't get a #NUM! error in the "working" section, why do I get one in the "off" section?

    It seems that I would always get one, or never get one. I don't know why it's only in one section, when the formulas are constructed the same. Plus, I thought the beginning of the formula accounted for that, with a "if it's nothing, than do nothing" code.

    While I have you, you'll see columns marked "Leave". An employee, although scheduled to work, can take "Leave" and have the day off. That worker should then move to the "off" section, and someone else has to be hired in their place for the day.

    The "Leave" columns are already set with a drop-down with the different types of Leave. Upon selection, I want the worker to move from the "working" area to the "off" area. If a mistake is made, or the worker decides later that he doesn't want the day off, I'd like to be able to undo the change and move the worker back. Can someone help with a VBA/code/macro to make that happen?

    Thanks for helping this amateur.
    Attached Files Attached Files

  2. #2
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Pesky #NUM! Error, Writing VBA to move Text based on Drop Down

    Don't know what the function is doing, but this is what's causing the error.
    In the rows with the #NUM error the array generated by the IF in the SMALL-function has 2 numeric values, but the k is 3.
    You can visualize this by selecting the IF-part in the formula and press F9. This will evaluate that part of the formula.
    Very helpfull when debugging formulas.
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

+ 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. Move a row based on a drop down outcome please help
    By Nickobrien22 in forum Excel General
    Replies: 2
    Last Post: 02-08-2017, 12:11 PM
  2. error writing to cell if a numeric text box is empty
    By Roberta.Walker in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-07-2016, 02:34 PM
  3. Type Mismatch Error for writing text in a cell
    By PleaseHelpMe3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2016, 06:29 PM
  4. Pesky "Object Required" error
    By Coleman34 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-17-2015, 09:06 AM
  5. Replies: 2
    Last Post: 01-12-2015, 02:27 AM
  6. Move entire row based on drop down selection
    By JamieNick1520 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-20-2014, 08:08 PM
  7. Help writing macro to move around text
    By Joe028 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2011, 11:11 AM

Tags for this Thread

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