+ Reply to Thread
Results 1 to 4 of 4

Can't figure out what I'm doing wrong - VBA help

  1. #1
    Registered User
    Join Date
    03-14-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Can't figure out what I'm doing wrong - VBA help

    I'm a noob at VB, and totally self taught. The following code is for a time sheet, which automatically fills in the shift based on the date. There are 4 possible schedule patterns, Day Shift, Night Shift, Daywork and Daywork Training. It looks on a hidden sheet that has the shift pattern in the cells and the shift type represented by:

    D = Day shift
    N= Night Shift
    DW = Daywork (8 hr Mon-Fri)
    DT = Daywork Training

    They all work except for the final one (Daywork Training), which fills in ALL the slots on the timesheet, as if all shifts were selected. I'm pulling my hair out, because it's the exact same IF-THEN format as the other schedules, but it doesn't work. Any help is appreciated. (I know there are probably more efficient ways to write this code, bbut like I said, I'm a self taught noob)

    I hope I explained this well enough.






    Please Login or Register  to view this content.
    Last edited by tedkord; 02-03-2015 at 07:09 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Can't figure out what I'm doing wrong - VBA help

    Hello tedkord,

    To help you with this problem, you need to post your workbook.

    This allows solutions to be tested using your code and not on code recreated based on your post.
    If your workbook contains any sensitive information, please redact that information before you post.

    How To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    03-14-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Can't figure out what I'm doing wrong - VBA help

    OK, thanks. I'm adding it. I kind of had to castrate it a bit (took out the auto open which pulls values from another remote sheet). I changed all the names/values for the privacy of the people on it.

    Basically, if you change the Name or shift (data validation drop downs) or the date of the first day, it should fill in the sheet with your schedule. It worked fine when I had the two shiftwork schedules and straight daywork, but when I added the daywork training schedule, it went flooey. I have noticed that if you change the name now, it fills in all the days, but if you choose the shift drop down, it fills it in right.

    I apologize in advance for how convoluted this likely is from a setup standpoint. I hope it's understandable.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    03-14-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Can't figure out what I'm doing wrong - VBA help

    I got it. I'm an idiot - it was a simple typo between what the macro was looking for in a cell and the actual value. Thanks for looking anyway.

+ 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. Replies: 4
    Last Post: 08-28-2014, 08:01 PM
  2. Troubleshoot my formula that I can't figure out what is wrong with
    By smockpuv in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-15-2013, 10:59 AM
  3. HELP, i am having an error and cant figure out whats wrong with my vba
    By basmienis in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2012, 06:55 AM
  4. cant figure out what I'm doing wrong or missing...
    By soundengineer in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-25-2007, 07:40 PM
  5. Cell displaying wrong figure
    By tcapewell in forum Excel General
    Replies: 1
    Last Post: 01-26-2005, 07:52 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