+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    10-01-2008
    Location
    Canada
    Posts
    9

    check column for nonblank data

    Hello everyone,

    I'm currently working on an excel project for work, to replace our production tracking to something more current (anything is better than pen and paper!). I am in charge of keeping track of cases of product made on our shift: product code, flavour, bag size, current shift scheduled #s, next shift scheduled #s, total scheduled #s, produced (on our shift), and product on hold. For the most part, I've achieved to get all of it working, but I want to take it one step further, where it is completely automated.

    Normally during the dayshift, we will receive an attainment report from the scheduler, and on this schedule, it lists out what amts are scheduled for each code, for the next 3 shifts. We would then manually write down each product code running on our shift, how much we're scheduled to run on our shift, and the next shift. Before the end of our shift, we would write up another production sheet for the afternoon shift, and the afternoon shift would do the same for the midnight shift, and again for dayshift until the scheduler revised the attainment report.

    My file consists of 5 worksheets: Days, Afternoons, Midnights, Product, Schedule

    Days, Afternoons, Midnights will be where production data is stored throughout each shift.

    Product holds records for each type of product we produce.

    Schedule holds the scheduled #s for each product scheduled to run for the next 3 shifts.

    So finally getting to the point, I would like to check the Schedule worksheet, column C for any non-blank cells, and copy the corresponding product code to the dayshift worksheet starting at A3, and the same for column F for afternoons, and column I for midnights.

    Hopefully this makes some kind of sense, so I will attach my file for extra info.

    TY for taking the time to read lol

    sorry bout the short subject, i keep getting errors if i try to add any more to it
    Attached Files Attached Files
    Last edited by VBA Noob; 10-02-2008 at 09:18 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & read 2007
    Posts
    15,495
    Hello Vampylestat,

    The following macros have been added to the attached workbook. There is one macro per shift named: UpdateShift1, UpdateShift2, UpdateShift3. These will update the "Days", "Afternoons", and "Midnights" worksheets respectively with the scheduled information in columns "C", "F", and "I" on the "Schedule" worksheet.
    Code:
    Sub UpdateShift(ByVal Shift_Number As Integer)
    
      Dim Code
      Dim CodeColumn As Variant
      Dim CodeRow As Long
      Dim DstRng As Range
      Dim R As Long
      Dim SchedWks As Worksheet
      Dim ShiftName As String
      Dim ShiftWks As Worksheet
      Dim SrcRng As Range
      Dim Units As Long
      Dim UnitsColumn As Variant
      
        Set SchedWks = Worksheets("Schedule")
        CodeColumn = "A"
        
        Select Case Shift_Number
          Case 1
            ShiftName = "Days"
            UnitsColumn = "C"
          Case 2
            ShiftName = "Afternoons"
            UnitsColumn = "F"
          Case 3
            ShiftName = "Midnights"
            UnitsColumn = "I"
        End Select
        
        Set ShiftWks = Worksheets(ShiftName)
        ShiftWks.Range("A3:A30").ClearContents
        CodeRow = 3
        
           For R = 3 To 30
             Code = SchedWks.Cells(R, CodeColumn)
             Units = SchedWks.Cells(R, UnitsColumn)
               If Units > 0 Then
                 ShiftWks.Cells(CodeRow, "A") = Code
                 CodeRow = CodeRow + 1
               End If
           Next R
           
    End Sub
    
    Sub UpdateShift1()
      Call UpdateShift(1)
    End Sub
    
    Sub UpdateShift2()
      Call UpdateShift(2) 
    End Sub
    
    Sub UpdateShift3()
      Call UpdateShift(3)
    End Sub
    To Run the Macro...
    To run the macro from Excel, open the workbook, and press ALT+F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.

    Sincerely,
    Leith Ross
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-01-2008
    Location
    Canada
    Posts
    9
    Thank you Leith, this is excellent! We're all excited to get this working and getting rid of the old system.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Move data daily into new column
    By rbuthello in forum Excel Programming
    Replies: 15
    Last Post: 05-27-2008, 09:29 AM
  2. Freezing old data in excel
    By sapphire in forum Excel General
    Replies: 6
    Last Post: 05-26-2008, 06:40 PM
  3. check a row of data for a value return a boolean result
    By js999 in forum Excel Programming
    Replies: 2
    Last Post: 10-04-2007, 01:32 PM
  4. Formula to find most recent column of data
    By cm_027 in forum Excel Programming
    Replies: 5
    Last Post: 06-07-2007, 09:59 AM
  5. Replies: 20
    Last Post: 04-04-2007, 06:36 PM

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.2.0