+ Reply to Thread
Results 1 to 5 of 5

VB Code to Create summary schedule by bringing schedule data from different sheet

Hybrid View

rmomin VB Code to Create summary... 04-19-2021, 02:21 PM
nankw83 Re: VB Code to Create summary... 04-19-2021, 03:12 PM
Bo_Ry Re: VB Code to Create summary... 04-19-2021, 03:19 PM
rmomin Re: VB Code to Create summary... 04-19-2021, 04:11 PM
nankw83 Re: VB Code to Create summary... 04-19-2021, 04:19 PM
  1. #1
    Forum Contributor
    Join Date
    01-31-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2010
    Posts
    194

    VB Code to Create summary schedule by bringing schedule data from different sheet

    Hello:

    Please refer to attached file.

    LJ,WE,EL,BN,,etc until TN are the Name of the stores.
    In each of the tab, I will be creating work schedule.

    I need VB Code to do following task.
    Sheet "FullSch" will have list of all Employees.

    I need to go thru each employee and see if he/she is scheduled in any of the
    stores LJ Thru TN.
    If they are then bring and enter the schdeule time and Name of the store in
    the day column C thru I.

    I have manually created 2 employees "Colleen Laird, Linda Pater "information as shown

    Let me know if you have any questions.
    Thanks.

    R
    Attached Files Attached Files

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: VB Code to Create summary schedule by bringing schedule data from different sheet

    Hi rmomin,

    Try below code ...

    Sub test()
    
    Dim ws As Worksheet, Sh As Worksheet, Rg As Range
    Set Sh = Sheets("FullSch")
    
    For x = 6 To Sh.Range("A" & Rows.Count).End(3).Row
       For Each ws In Sheets(Array("LJ", "WE", "EL", "BN", "SO", "WO", "CW", "LB", "PC", "HO", "AP", "TN"))
          Set Rg = ws.Columns(2).Find(Sh.Cells(x, 1), lookat:=xlWhole, LookIn:=xlValues)
             If Not Rg Is Nothing Then
                For i = 1 To 7
                   If Rg.Offset(, i).Value <> "." And Not IsEmpty(Rg.Offset(, i).Value) Then
                      Sh.Cells(x, 2).Offset(, i) = Rg.Offset(, i).Value & " " & ws.Name
                   End If
                Next
             End If
          Set Rg = Nothing
       Next
    Next
    
    End Sub
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  3. #3
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,223

    Re: VB Code to Create summary schedule by bringing schedule data from different sheet

    Please try

    Sub gat()
    Dim sh As Worksheet, a, d As Object, r As Range, i As Long
    Set d = CreateObject("Scripting.Dictionary")
    ReDim a(1 To Sheets("FullSch").[C3].CurrentRegion.Columns.Count)
        For Each r In Sheets("FullSch").[A6].CurrentRegion
            d(r.Value) = a
        Next
        For Each sh In ThisWorkbook.Sheets
            If Len(sh.Name) = 2 Then
                For Each r In sh.Range("B6", sh.Cells(Rows.Count, 2).End(xlUp))
                    If d.Exists(r.Value) Then
                        For i = 1 To UBound(a)
                            If Len(r.Offset(, i)) > 2 Then
                                a = d(r.Value)
                                a(i) = r.Offset(, i) & " " & sh.Name
                                d(r.Value) = a
                            End If
                        Next
                    End If
                Next
            End If
        Next
    a = Application.Transpose(Application.Transpose(d.items))
    Sheets("FullSch").[C6].Resize(UBound(a), UBound(a, 2)) = a
    End Sub
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    01-31-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2010
    Posts
    194

    Re: VB Code to Create summary schedule by bringing schedule data from different sheet

    Hello Bo and nan

    Great work, thanks a lot, it works

    R

  5. #5
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: VB Code to Create summary schedule by bringing schedule data from different sheet

    Glad to help & thanks for the Rep+

    If that takes care of your question, please take a moment & mark the thread as [SOLVED] from the Thread Tools above your first post

+ 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. Auto Create Daily Break Schedule from Weekly Work schedule
    By colema62 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-27-2021, 04:31 PM
  2. Noob here- best approach to extract personal schedule based on an employee schedule sheet,
    By fortnight_skyrim in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-15-2018, 01:02 AM
  3. Create a schedule of events from data sheet
    By sipa in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-03-2015, 05:11 PM
  4. Create Individual Schedule from Master Schedule
    By kscheller in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-24-2014, 11:47 PM
  5. create daily schedule using master task schedule
    By DCO in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2012, 01:08 PM
  6. Shift Schedule - 3 Shift Coverage - Auto Populate Roll-up Summary Schedule
    By chips1256 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-31-2012, 09:32 AM
  7. Replies: 8
    Last Post: 10-12-2005, 12:05 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