[ ίΔΜϋΦ | κ(ΕVXV) | SΆυ | ίO ]
@
woΞΤπo΅½’Ε·BxiηΆj
Private Sub Btn_Attnd_Create_Click()
If Cmb_Year = "" Then
MsgBox "Nπ³΅Iπ΅ΔΎ³’"
Exit Sub
End If
If Cmb_Month = "" Then
MsgBox "π³΅Iπ΅ΔΎ³’"
Exit Sub
End If
Dim Month_Start As Date
Dim Month_End As Date
Dim Wk_Year As Variant
Dim Wk_Month As Variant
Dim Year_Cnt As Long
Dim Month_Cnt As Long
Dim Month_day As Long
Year_Cnt = Frm_Make_Calender.Cmb_Year.ListIndex
Month_Cnt = Frm_Make_Calender.Cmb_Month.ListIndex
Wk_Year = Frm_Make_Calender.Cmb_Year.List(Year_Cnt)
Wk_Month = Frm_Make_Calender.Cmb_Month.List(Month_Cnt)
Month_Start = DateSerial(Wk_Year, Wk_Month, 1)
Month_End = DateSerial(Wk_Year, Wk_Month + 1, 1) - 1
Month_day = Month_End - Month_Start + 1
Dim i As Long, j As Long
Dim Ctr As Long
Dim Wk_Name() As String
Dim ws As Worksheet
Set ws = Worksheets("Πυκ")
i = 6
j = 0
Ctr = ws.Cells(6, 3).End(xlDown).Row - ws.Cells(6, 3).Row
ReDim Wk_Name(Ctr)
For i = 6 To ws.Cells(6, 3).End(xlDown).Row
Wk_Name(j) = ws.Cells(i, 3)
j = j + 1
Next
Dim CurrentPath As String, SaveName As String
CurrentPath = ActiveWorkbook.Path
Dim Src As Workbook, Dst As Workbook
Set Src = Workbooks.Open(Filename:=CurrentPath & "\ΞΣ.xlsm")
SaveName = Wk_Year & "N" & Wk_Month & "" & "ΞΣ.xlsm"
Src.SaveAs Filename:=CurrentPath & "\" & SaveName
Set Dst = Workbooks(SaveName)
ThisWorkbook.Worksheets("Πυκ").Copy after:=Dst.Worksheets("Sheet1")
Dim k As Long
Dim EachName
Dim DstSheet As Worksheet
Dim Wk_Date As Date
For Each EachName In Wk_Name
Dst.Worksheets.Add after:=Sheets(Sheets.Count)
Set DstSheet = Dst.ActiveSheet
DstSheet.Name = EachName
DstSheet.Cells(1, 1).Value = EachName
DstSheet.Cells(1, 2).Value = "oΞ"
DstSheet.Cells(1, 3).Value = "ήΞ"
DstSheet.Cells(1, 4).Value = "JΤ"
DstSheet.Cells(1, 5).Value = "cΖΤ"
DstSheet.Range(Cells(1, 1), Cells(1, 5)).HorizontalAlignment = xlCenter
Wk_Date = Month_Start
For k = 2 To Month_day + 1
DstSheet.Cells(k, 1) = Wk_Date
DstSheet.Cells(k, 1).NumberFormatLocal = "m""""d""ϊ"""
DstSheet.Range(Cells(k, 2), Cells(k, 3)).Locked = False
DstSheet.Cells(k, 4).FormulaR1C1 = "=IF(RC[-2]="""","""",CEILING(RC[-2],""0:15""))"
DstSheet.Cells(k, 5).Formula = "=IF(RC[-2]="""","""",FLOOR(RC[-2],""0:15""))"
DstSheet.Range(Cells(k, 2), Cells(k, 5)).NumberFormat = "h:mm"
DstSheet.Range(Cells(k, 2), Cells(k, 5)).HorizontalAlignment = xlCenter
Wk_Date = Wk_Date + 1
Next
Application.ReferenceStyle = xlA1
DstSheet.Range("A1").CurrentRegion.Borders.LineStyle = xlContinuous
DstSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Next
Worksheets("Sheet1").Activate
Range("A1").Activate
Dst.Save
Dst.Close
Set DstSheet = Nothing
Set Dst = Nothing
End Sub
gp ExcelFOffice365Agp OSFWindows10
iηΆj 2020/05/02(y) 22:00
DstSheet.Cells(k, 4).FormulaR1C1 = "=IF(RC[-2]="""","""",CEILING(RC[-2],""0:15""))"
DstSheet.Cells(k, 5).Formula = "=IF(RC[-2]="""","""",FLOOR(RC[-2],""0:15""))"
«
DstSheet.Cells(k, 4).FormulaR1C1 = "=IF(COUNT(RC[-2]:RC[-1])<2,"""",FLOOR(RC[-1],""0:15"")+(RC[-1]<RC[-2])" & _
"-CEILING(RC[-2],""0:15"")-(FLOOR(RC[-1],""0:15"")+(RC[-1]<RC[-2])" & _
"-CEILING(RC[-2],""0:15"")-""4:59:59"">=0)*""1:15"")"
DstSheet.Cells(k, 5).FormulaR1C1 = "=IF(RC[-1]="""","""",MAX(0,RC[-1]-""7:45""))"
iΌ½Ύj 2020/05/03(ϊ) 00:23
[ κ(ΕVXV) ]
YukiWiki 1.6.7 Copyright (C) 2000,2001 by Hiroshi Yuki.
Modified by kazu.