+ Reply to Thread
Results 1 to 52 of 52

Change Roster values

Hybrid View

Bloodywog Change Roster values 04-03-2012, 07:47 PM
jaslake Re: Roster Issue - Change... 04-04-2012, 04:10 PM
Bloodywog Re: Roster Issue - Change... 04-05-2012, 12:30 AM
jaslake Re: Roster Issue - Change... 04-05-2012, 01:48 PM
Bloodywog Re: Roster Issue - Change... 04-05-2012, 03:39 PM
Bloodywog Re: Roster Issue - Change... 04-06-2012, 12:09 AM
jaslake Re: Roster Issue - Change... 04-06-2012, 11:51 AM
Bloodywog Re: Roster Issue - Change... 04-06-2012, 05:12 PM
jaslake Re: Roster Issue - Change... 04-08-2012, 03:33 PM
Bloodywog Change Roster values 04-09-2012, 06:35 AM
jaslake Re: Change Roster values 04-09-2012, 12:31 PM
jaslake Re: Change Roster values 04-11-2012, 07:16 PM
Bloodywog Re: Change values 04-12-2012, 11:09 AM
jaslake Re: Change values 04-12-2012, 11:42 AM
Bloodywog Re: Change values 04-12-2012, 02:23 PM
jaslake Re: Change values 04-12-2012, 02:41 PM
Reesedonald10 Re: Change values 04-19-2012, 02:47 AM
Bloodywog Re: Change Roster values 04-12-2012, 03:50 PM
jaslake Re: Change Roster values 04-12-2012, 05:09 PM
Bloodywog Re: Change Roster values 04-13-2012, 03:38 AM
jaslake Re: Change Roster values 04-13-2012, 09:18 AM
jaslake Re: Change Roster values 04-13-2012, 10:23 AM
Bloodywog Re: Change Roster values 04-13-2012, 11:43 AM
jaslake Re: Change Roster values 04-13-2012, 11:54 AM
jaslake Re: Change Roster values 04-13-2012, 12:31 PM
Bloodywog Re: Change Roster values 04-13-2012, 01:03 PM
jaslake Re: Change Roster values 04-13-2012, 01:18 PM
Bloodywog Re: Change Roster values 04-13-2012, 12:09 PM
Bloodywog Re: Change Roster values 04-14-2012, 06:12 AM
jaslake Re: Change Roster values 04-14-2012, 01:43 PM
jaslake Re: Change Roster values 04-15-2012, 02:09 PM
Bloodywog Re: Change Roster values 04-14-2012, 03:11 PM
Bloodywog Re: Change Roster values 04-15-2012, 05:02 PM
jaslake Re: Change Roster values 04-15-2012, 05:29 PM
Bloodywog Re: Change Roster values 04-19-2012, 02:40 AM
jaslake Re: Change Roster values 04-19-2012, 09:06 AM
ohlalayeah Re: Change Roster values 06-10-2012, 11:37 PM
jaslake Re: Change Roster values 06-10-2012, 11:52 PM
Bloodywog Re: Change Roster values 02-07-2013, 07:17 AM
jaslake Re: Change Roster values 02-07-2013, 11:11 AM
  1. #1
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Unhappy Change Roster values

    Hi All,

    I spend hours a week manually changing the default roster when employee's do any overtime or call in sick.

    I normally have a roster for the whole year send this to staff on weekly basis with what they are doing. When ever someone is sick or does any overtime, i find the date it occured on and then change it accordialy manually.

    Is there a way to do it automatically for me? Any formula to find a date from the roster and change it if any changes do occur?

    The end result I am looking for is that the main roster does not change unless the second sheet has data in it. Do I make sense? I have attached a excel sheet. One sheet has the roster for april and second sheet with dates/reason for roster change.

    I appreciate if someone can help me.
    Last edited by Bloodywog; 04-09-2012 at 07:56 PM.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Roster Issue - Change Roster values

    Hi Bloodywog
    Place this code in a General Module...let me know of issues.
    Option Explicit
    Sub Test()
        Dim myName As String
        Dim ws1 As Worksheet
        Dim ws2 As Worksheet
        Dim myDate As Date
        Dim myCol As Range
        Dim myRow As Range
        Dim Rng As Range
        Dim cel As Range
        Dim LR As Long
        
        Set ws1 = Sheets("RosterApril")
        Set ws2 = Sheets("Overtime&Sick")
        With ws2
            LR = .Range("A" & .Rows.Count).End(xlUp).Row
            Set Rng = .Range("A2:A" & LR)
        End With
    
        For Each cel In Rng
            If cel.Offset(0, 3).Value <> "X" Then
                With ws1
                    myName = cel.Value
                    myDate = Format(cel.Offset(0, 1).Value, "m/dd/yyyy")
                    Set myRow = ws1.Columns(1).Find(myName)
                    Set myCol = ws1.Rows(2).Find(myDate)
                    Intersect(myRow.EntireRow, myCol.EntireColumn) = cel.Offset(0, 2).Value
                    cel.Offset(0, 3).Value = "X"
                End With
            End If
        Next cel
    End Sub
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Wink Re: Roster Issue - Change Roster values

    Hi jaslake

    OMG.. Can’t believe it!! That's fantasic jaslake!!! I would never have worked that out without your help. Thank you Thank you…

    I attempted to use INDEX, MATCH and LOOKUP last night to work it out. I just have one more question. When I was trying to work it out last night, I thought it be easier if I put the roster for the year and I had 2 more scenarios popped up that I need to add if it can be done. Employees do shift swaps and I need to add Personal Leave.. Will this still work if I added the entire year?

    I have attached an amendment worksheet with roughly how I want it to be. I was thinking I have different sheets for O/T, Sick, Personal Leave and Shift Swaps. I’m open to suggestions and anything to stop any troubles that will arise. The "Shift Swap" may be a little difficult but I am happy to enter this manually if the reest are done automatically.

    Again.. I really appreciate your help. I can't thank you more.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Roster Issue - Change Roster values

    Hi Bloodywog
    Try the code in the attached. Please note, there's no error checking.

  5. #5
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Roster Issue - Change Roster values

    Hey.

    At the moment everything working great. I can't thank you enough! You have saved me hours of head aches and save tones of time. I really appreciate it!

    Thanks heaps mate.
    Last edited by Bloodywog; 04-05-2012 at 06:27 PM.

  6. #6
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Lightbulb Re: Roster Issue - Change Roster values

    Just one more thing jastake. The worksheet works like a charm until I add more sheets. A Runtime error 13 - Type Mismatch shows. When I look at the roster, everything gets added then error occurs. I looked into the code and I think we need it to stop looking at all sheets defined in the start of code?

    I'm new to excel and slowly learning.

    A few things that will improve the sheet if it can be done:

    1 - Having the ability to add more sheets without any errors. Maybe define only the sheets i require to update the roster? E.g. Overtime, Sick Leave, Personal Leave, Maternity Leave, Shift Swaps & Annual Leave sheets?
    2 - Additional macro to Clear the "X" or to under changes if you make a mistake (if possible)

    I have attached a copy of the worksheet. I plan to add additional 5-8 sheets in next few months to send email using macros, planners and create reports and pivot tables.

    Thanks heaps for the help. Over the last couple of months it was taking me many hours to manually add data in. This is all done via a macro now and takes just a couple of minutes. Really appreciate it.

    Bloodywog

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Roster Issue - Change Roster values

    Hi Bloodywog
    Something for you to ponder...how would you envision this working
    Additional macro to Clear the "X" or to under changes if you make a mistake
    Clearing ALL the X's would be quite simple; undoing changes to Roster2012 would be impossible unless O is the default since I have no idea what it was before the change. If you wish to change individual records let me know how you'd like it to work.

    I'll need to look at it...my time will be limited this weekend due to the Holiday. I'll get back to you.
    Last edited by jaslake; 04-06-2012 at 01:04 PM.

  8. #8
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Roster Issue - Change Roster values

    Hey jastake

    Thanks for the prompt reply. The additional macro to clear "X" is not required. It was just a thought.

    I would like to have the Additional sheets added in future.

    Have a good Easter Break.

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Roster Issue - Change Roster values

    Hi Bloodywog
    The code in the attached has been modified to accommodate this
    Having the ability to add more sheets without any errors. Maybe define only the sheets i require to update the roster? E.g. Overtime, Sick Leave, Personal Leave, Maternity Leave, Shift Swaps & Annual Leave sheets
    It also includes stand alone procedures and a UserForm to do this
    change individual records
    You can use this feature or lose it...your option.
    Let me know of issues.

  10. #10
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Lightbulb Change Roster values

    Hi jastake

    Again, thanks for looking into it for me. I have revised the Roster, the changes that I raised are highlighted in yellow.

    I be reading more into it tonight. I hope I am not too much trouble.

    In regards to the form, I love
    this feature
    in the Userform to change individual records! It will come very handy!

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi Bloodywog
    Based on this
    I be reading more into it tonight
    I'm going to wait a few days until you've told me that what you have is what you want. We're already well beyond the scope of your original issue with the enhancements we've made. Mind you, I don't mind helping with the enhancements but we've been working on a moving target. Settle it down to where you want it to be...let me know when you've done that then post your file with the final structure...I'll look at it.

  12. #12
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Thumbs up Re: Change Roster values

    Hi

    Sorry for making you work on a moving target.

    This will be the last post regarding my issue.

    I have highlighted in the sheet in yellow of changes that I require.
    • I have insert a engine to work out roster automatically
    • Menu sheet – The modify form is a Calender Icon to make a calendar pop up. I need the
    code to insert it in date field.
    • RecLeave sheet - I have from and to dates to insert in the roster. On the side I have the planner to show the dates
    • Overtime - Can we these fields be updated from "OTSummary" sheet? So it continues down and updates the roster.
    • CleaningRoster – Employee also have cleaning roster. Normally 2 employees clean but not always.
    • OTSummary – I need to record all OT worked. When it’s setup, I like “Overtime” sheet to ref to this sheet.

    I really do appreciate your help and time. I have learnt from your postings.
    Last edited by Bloodywog; 04-09-2012 at 08:28 PM.

  13. #13
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi Bloodywog
    You'll need to beat this up. I believe these issues have been addressed
    I have highlighted in the sheet in yellow of changes that I require.
    • I have insert a engine to work out roster automatically
    • Menu sheet – The modify form is a Calender Icon to make a calendar pop up. I need the
    code to insert it in date field.
    • RecLeave sheet - I have from and to dates to insert in the roster. On the side I have the planner to show the dates
    • Overtime - Can we these fields be updated from "OTSummary" sheet? So it continues down and updates the roster.
    • CleaningRoster – Employee also have cleaning roster. Normally 2 employees clean but not always.
    • OTSummary – I need to record all OT worked. When it’s setup, I like “Overtime” sheet to ref to this sheet.
    You've got a lot going on here...I'd not expect all to be to your liking the first time around...so, let me know of issues.

  14. #14
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change values

    Hi jaslake

    You are a guru.

    It's all looking good. I have a few notes.
    1. I opened this spreadsheet on 4 computers and only 1 worked. The other 3 computers don't have the DatePicker installed on the PC's. As soon you open the spreadsheet, the error message shows and goes straight to debug. In the UserForm_Initialize code, frmCalendar.DatePicker = Sheets("Group SR").Range("L1").Value is highlighted. On the other PC, when you update roster it say's "Object variable or With Block variable not set. Intersect(myRow.EntireRow, myCol.EntireColumn) = cel.Offset(0, 3).Value. I did not adjust anything.
    2. I need to modify some of the employees on the roster. Do I change it from the engine or Roster2012 sheets?
    3. In the OTSummary Sheet, when you add a new row the time cannot be adjusted. They default to 00:00.

    There is a lot going on. If you can think of something to make it easier, your advice is appreciated.

    I'm very happy. Everything else is great. Many Thanks.

  15. #15
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change values

    Hi Bloodywog
    Well, for starters, I'm going to consider installing a different date picker.
    Regarding this
    2.I need to modify some of the employees on the roster. Do I change it from the engine or Roster2012 sheets?
    The way your spreadsheets are set up, you'll need to modify on both. I'll think about it.
    Regarding this
    3.In the OTSummary Sheet, when you add a new row the time cannot be adjusted. They default to 00:00.
    On my machine that does not happen. Does this happen on the workbook I uploaded or on another version of the workbook?

  16. #16
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change values

    Hi

    It seems datepicker is not installed on most computers. I noticed that there were two versions of Excel, 2007 and 2010 on the pc's. Does this matter?

    In regards to the OTSummary sheet, this happened on the latest workbook you uploaded.
    Last edited by Bloodywog; 04-12-2012 at 02:29 PM.

  17. #17
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change values

    Hi Bloodywog
    I've inserted into the code a Date Picker that's not dependent on the Microsoft Version needing to be installed on the User's computer. I believe you'll be satisfied with it.
    Regarding Time Entry on OTSummary...enter the Time WITHOUT THE COLON and let me know what happens.
    Regarding modifying Employee Names...are you saying MODIFY (as in change) or are you also needing to ADD names?

    I use Excel 2007...I don't believe there will be an issue with Excel 2010...but, I honestly don't know...guess we'll find out
    Last edited by jaslake; 04-12-2012 at 03:09 PM.

  18. #18
    Registered User
    Join Date
    02-28-2012
    Location
    958 Willison Street Maple Grove, MN 55369 958 Willison Street Maple Grove, MN 55369
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Change values

    I am one of the newest member of the site.

    Donald Reese here.

    Always at your service

    Thank you!

  19. #19
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change Roster values

    The workbook you sent keeps going to debug with DatePicker highlighted. I don't know why it's doing it.

    The Time Entry on OTSummary works like a charm without the colon.

    Regarding the modifying Employee names, I just want to change a few names not modifying the sheet. I just realised you have used Data Validation on columns and set the range to Surnames. Which is fine. I worked it out.

    I have been reading the code and you have done an awesome job. It be nice if you added some notes (')to help me understand it better. I may add to it later but I do not want to keep asking for your help, you have done enough.

    Maybe you can resend the workbook once you had another look at it?

    Cheers

  20. #20
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi Bloodywog
    I've not yet posted the workbook that has this
    I've inserted into the code a Date Picker that's not dependent on the Microsoft Version
    Wish I had as I've got a problem with the file ...I'll get it worked out.

    There may well be a rather simple fix for this
    modifying Employee names
    Regarding this
    It be nice if you added some notes (')to help me understand it better
    I'll be more that happy to do that...once we know it's working...don't want to have to change code AND notes...the notes will come...when the code works. I need to spend a bit of time to find the issue with my file...it's grown by about 400 KB and I don't know why...could be a corrupted worksheet...don't know. I'll post the new file as soon as I can get the issue resolved.

  21. #21
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change Roster values

    Hi jastake

    I was looking at this today. Firstly, if you remove the engine and the annual leave planner from RecLeav planner it runs a little faster. That is on my work computer.

    Maybe we should not double up on sheets, we can remove the "Overtime" Sheet and change the OTSummary sheet to "Overtime". There's a lot of code going on, reduce corruption and keeps it simple. When I create a summary sheet for "overtime", a Lookup/Match/Index formula can be used to find the staffs name and date worked and insert it in the sheet. Do you agree?

    I don't want you spending heaps of time and pulling your hair out to work out the code. Let me know.

  22. #22
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi Bloodywog
    Removing the Overtime sheet will have negligible impact on file size and processing speed. Your file is large and processing speed diminished due to the hundreds of formulas and formatting (both conditional and otherwise) contained in your file. The process has to work for you, not for me. I'll work on the existing file for a bit today. Let me know how you wish to proceed.

  23. #23
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi Bloodywog
    While you're pondering the future of this project play with the attached. A new Date Picker is incorporated that does not rely on the presence of the Microsoft Calendar Control. Also notice the Formulas in Roster2012 range A3:A14 which address this issue
    modifying Employee names
    Your Annual Leave Planner appears to not update properly. I've not worked on this at all so you'll need to look at it.
    Let me know how you wish to proceed.

  24. #24
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change Roster values

    jaslake

    DatePicker is working great.

    There was one problem, when I press "update roster", is says Run-time error '91': object variable or With block variable not set. It's on Ln 57. Then when I checked the roster, I do see "RL" changes but nothing else (Al, SWAP etc). I looked through your code and changed all the date formats "mm/dd/yyyy" to "dd/mm/yy" and it worked fine. Is this because my computer set to Australia? I double checked and put it to US and it worked. It appears that it's sensitive to formats.

    In regards to
    Annual Leave Planner appears to not update properly
    I looked at it and rectified it.

    I understand that due to the hundreds of formulas and formatting there will be some delays. I will not worry about
    Removing the Overtime sheet
    I need to add 2 more columns in RecLeave sheet. Which line do I change the (row,column)?

    So Guru jaslake, it's almost done. I guess we can finish up the codes before were done.
    Last edited by Bloodywog; 04-13-2012 at 12:11 PM. Reason: Found solution after I posted.

  25. #25
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi Bloodywog
    Attached is a Screen Shot of results I get screen shot.jpg
    So, no, I don't get the error message your getting; I get the results expected.
    Make sure you clear all X's or the records will be passed by. If you can't get it resolved, attach the offending file...I'll look at it.

    I don't know what Line 57 is...show that part of the code with the line of code underlined (I'm color blind so colors won't work).
    Last edited by jaslake; 04-13-2012 at 11:57 AM.

  26. #26
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi Bloodywog
    Where will you do this?
    I need to add 2 more columns in RecLeave sheet
    Where will Date From, Date To, Shift & Posted Roster end up? Each shifted two columns to the right?

    I guess I assumed Name wll stay in the first column...True?
    Last edited by jaslake; 04-13-2012 at 12:34 PM.

  27. #27
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change Roster values

    I need the columns to be:


    Name / Time From / Start Date / Time To / End Date / Relief / Posted OT

    I can say now once that is done, we can wrap this up. You have done so much already.

    Then we can do the notes in the code
    I'll be more that happy to do that...once we know it's working
    Last edited by Bloodywog; 04-13-2012 at 01:08 PM.

  28. #28
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi Bloodywog
    Currently the code only evaluates the Start Date and the End Date; I assume you want the Start Time and End Time for posterity or you'll use it as you see fit. True?

  29. #29
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change Roster values

    Hi

    No. I still want the code to evaluate the Start and End Dates only. The times are there for HR purposes, just display employee start/end times. Is this a problem for the code?

  30. #30
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change Roster values

    jaslake

    Go back to my previous post. I edited. As soon I replied, I changed it.

  31. #31
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change Roster values

    Hi Guru jaslake

    It all make sense to me except for the cleaning roster part. I played around with it, adding columns adjusting it accordingly but no luck. Can you help me adjust cleaning roster sheet to have the following headers:

    Date / Start / Finish/ Location / Employee / Employee / Yes or No / Shift / Posted Roster

                Case "CleaningRoster"
    
                    'CleaningRoster follows the same logic as above but the Heading Layout
                    'is different so requires different handling.  If it does not make sense
                    'let me know
                   Set rng = .Range("A3:A" & LR)
                    For Each cel In rng
                        If cel.Offset(0, 4).Value <> "X" Then
                            sYear = Year(cel.Offset(0, 2).Value)
                            sMonth = WorksheetFunction.Text(cel.Offset(0, 2).Text, "mmm")
                            With ws1
                                Set myRng = .Range(sMonth & "_" & sYear)
                                myName = cel.Value
                                myName2 = cel.Offset(0, 1).Value
                                myDate = Format(cel.Offset(0, 2).Value, "dd/mm/yy")
                                Set myCol = myRng.Rows(1).Find _
                                        (what:=DateValue(myDate), LookIn:=xlFormulas)
    
                                On Error Resume Next
                                Set myRow = .Columns(1).Find(what:=myName, After:=.Cells(myRng.Rows(1).Row, 1), LookIn:=xlValues, LookAt:= _
                                        xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
                                        , SearchFormat:=False)
                                On Error GoTo 0
    
                                On Error Resume Next
                                Set myRow2 = .Columns(1).Find(what:=myName2, After:=.Cells(myRng.Rows(1).Row, 1), LookIn:=xlValues, LookAt:= _
                                        xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
                                        , SearchFormat:=False)
                                On Error GoTo 0
                                Intersect(myRow.EntireRow, myCol.EntireColumn) = cel.Offset(0, 3).Value
                                On Error Resume Next
                                Intersect(myRow2.EntireRow, myCol.EntireColumn) = cel.Offset(0, 3).Value
                                On Error GoTo 0
                                cel.Offset(0, 4).Value = "X"
                            End With
                        End If
                    Next cel
                End Select
            End With
        Next vWks
    End Sub
    Secondly, I was checking the OTSummary sheet code, the "reason" column adds it to the roster. This is not correct because then 2 employees will be OT when suppose to be one. The employee that works the OT is in 1-2 column.
    Last edited by Bloodywog; 04-14-2012 at 10:39 AM.

  32. #32
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi Bloodywog
    Sorry...didn't get an email on your edited post #37. One apparently does NOT get notifications on edits. Are Start and Finish times of the day?

  33. #33
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi Bloodywog
    The code in the attached has been modified for this in Cleaning Roster
    Date / Start / Finish/ Location / Employee / Employee / Yes or No / Shift / Posted Roster
    and this in Overtime
    The employee that works the OT is in 1-2 column.
    I ran the procedures several times and all appears well to me. As before, you'll need to modify Date Formats as required. Let me know of issues.

  34. #34
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change Roster values

    Hi jaslake

    Are Start and Finish times of the day
    yes

  35. #35
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change Roster values

    jaslake

    Thanks.

    I just got home and looked at the attachment on post #40. It runs well except the Cleaning Roster "CR" does not show on the roster. A blank white spot appears instead of showing CR.

    Looking through it, I can't see to see nothing wrong with it. Does yours show "CR" on roster?

  36. #36
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi Bloodywog
    Ha...caught me again!!! In Module UpDate_Roster in the Cleaning Roster section (down toward the bottom) change these two lines of code from
    On Error GoTo 0
                                Intersect(myRow.EntireRow, myCol.EntireColumn) = cel.Offset(0, 3).Value 'change this 3 to 7<----
                                On Error Resume Next
                                Intersect(myRow2.EntireRow, myCol.EntireColumn) = cel.Offset(0, 3).Value 'change this 3 to 7<----
    
                                On Error GoTo 0
    to
    On Error GoTo 0
                                Intersect(myRow.EntireRow, myCol.EntireColumn) = cel.Offset(0, 7).Value 'to this
                                On Error Resume Next
                                Intersect(myRow2.EntireRow, myCol.EntireColumn) = cel.Offset(0, 7).Value 'to this
                                On Error GoTo 0

  37. #37
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change Roster values

    jaslake

    Everything running beautiful! Thanks heaps.

    I have done a lot since last post. Main thing is I created custom forms for each of the sheets. All forms have date text boxes. I like it to be like the Modify Form. What is the code so that the calender places the entry to the textbox enter event? Can I call the same Calender for seperate forms or do I need multiple calender in each form?

    Can I just copy and paste this code:
    Private Sub TextBox1_Change()
            Dim myName As String
            sYear = Year(Me.TextBox1.Value)
            sMonth = WorksheetFunction.Text(Me.TextBox1.Text, "mmm")
            Set ws1 = Sheets("Roster2012")
            With ws1
                Set myRng = .Range(sMonth & "_" & sYear)
                myName = Me.ComboBox1.Value
                myDate = Format(Me.TextBox1.Value, "dd/mm/yyyy")
                Set myCol = myRng.Rows(1).Find _
                        (what:=DateValue(myDate), LookIn:=xlFormulas)
    
                On Error Resume Next
                Set myRow = .Columns(1).Find(what:=myName, After:=.Cells(myRng.Rows(1).Row, 1), LookIn:=xlValues, LookAt:= _
                        xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
                        , SearchFormat:=False)
                On Error GoTo 0
                If Not myRow Is Nothing Then    'Application.Goto myRow, True
                    Me.TextBox2.Value = Intersect(myRow.EntireRow, myCol.EntireColumn).Value
                End If
            End With
        End If
        EventsOff = False
        SendKeys "{TAB}"
    End Sub
    The date format should be dd/mm/yy when inserted in textbox field.

  38. #38
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi Bloodywog
    Regarding this
    Can I call the same Calender for separate forms
    Yes

    Regarding this
    Can I just copy and paste this code
    If your UserForm models the Modify Form, I should think so...may take a bit of tweaking but the code would be substantially the same.

    However, if you're ADDING records to the Target Worksheet, while the Calendar Control will be the same and can be called in the same way, you'll need to develop the code to post the ADDED data to the Target worksheet.

    Good luck!
    Last edited by jaslake; 04-19-2012 at 09:13 AM.

  39. #39
    Registered User
    Join Date
    05-30-2012
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    95

    Re: Change Roster values

    Wow! I like this so much! But I am using Excel 2003, can you post a workable roster file for me here?

  40. #40
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi ohlalayeah

    See this rule...act accordingly
    2. Don't post a question in the thread of another member -- start your own. If you feel it's particularly relevant, provide a link to the other thread

  41. #41
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change Roster values

    jaslake

    The spreadsheet is working beautiful! Few changes along the way but it's saved me sooooo much time. Many thanks.

    I have few more questions. I didn't see any ruling regarding this. Can you help me out?

  42. #42
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change Roster values

    Hi Bloodywog

    I know of no rule that prohibits this
    I have few more questions. I didn't see any ruling regarding this
    However, this is a rather old Thread. I'd recommend you start a new Thread with your questions...you'll get much more Member interest. Add a link to this Thread if relevant.

    Or, if related to this Thread...ask away.

  43. #43
    Registered User
    Join Date
    03-10-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Change Roster values

    Hi jaslake

    Or, if related to this Thread...ask away.
    I do understand but I hope it's not too much trouble.

    I just like to add an additional sheet (LineSwap) to the spreadsheet we did. Using VBA, when staff take leave, the relief staff covering leave will automatically updated to roster. The relief staff will cover his "line" (shifts) while away. For this example,I manually updated the roster to show you. The update cells are in RED. I understand some days (before&after) may have to manually done. I accept that.

    Due to confidential information, I created a new sheet with additional sheet (LineSwap). All the codes in my current spreadsheet works great. I'm stuck.. I can't tell excel to replace "a" specific shift without doing my head in.

    Let me know if you have any questions.

    If I don't get much member interest, I will post a new thread.

    Thanks.
    Attached Files Attached Files

+ 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