📄 addexcel(4).frm
字号:
Exit Sub
End If
If Shi3 > "23:00" And Shi3 < "23:59" Then
BiJiaoShijian = DateDiff("h", Shi1, Shi3) '前时后负
If BiJiaoShijian < 11 Then
Exit Sub
Else
End If
End If
If Shi2 > "23:00" And Shi2 < "23:59" Then
BiJiaoShijian = DateDiff("h", Shi2, Shi1) '前时后负
If BiJiaoShijian < 11 Then
Exit Sub
Else
End If
End If
End Sub
Private Sub YiHang()
Dim Nian, T, EndTime
'Dim i As Index
OneFinish = False
GroupFinish = False
ShiKuaRi = False
Nian = Year(Date)
X = 0
T = 1
AA = SelMonth.Text
D1 = "01"
D2 = "31"
BB = Nian & AA & D1
CC = Nian & AA & D2
Do Until X = NameNum
If OneFinish = False Then
Row = 3 '7纵
Col = 2 + 3 * X 'B横
Else
Row = Row - 31
Col = Col + 4
End If
If X = 4 * T Then
Row = Row + 33
Col = Col - 16
GroupFinish = True
T = T + 1
'Do Until X = 7
End If
'If xlSheet.Cells(7, 2).Value <> "" Then
' Col = Col + 3
'Else
Ming = xlSheet.Cells(Row, Col).Value
'Ming = "冯健韵"
Do Until xlSheet.Cells(Row, 1).Value = 31
ShiKuaRi = False
Ri = Nian & AA & xlSheet.Cells(Row + 1, 1).Value
Set Rst = New ADODB.Recordset
Rst.Open "select * from kaoqishuju where xingming='" + Ming + "'and riqi='" + Ri + "' order by riqi,shijian", Cnn, adOpenKeyset, adLockOptimistic, adCmdText
If Not Rst.EOF Then
'Exit Sub
'Else
If Rst!Banhao <> "2222" Then
If Rst.RecordCount = 2 Then
Shi = Format(Rst("shijian"), "hh:mm")
Rst.MoveNext
Shi1 = Format(Rst("shijian"), "hh:mm")
'CheKuaRi
Row = Row + 1
If Col <> 2 Or Col <> 6 Or Col <> 10 Or Col <> 14 Then
If Col = 3 Or Col = 4 Or Col = 5 Then
Col = 2
End If
If Col = 7 Or Col = 8 Or Col = 9 Then
Col = 6
End If
If Col = 11 Or Col = 12 Or Col = 13 Then
Col = 10
End If
If Col = 15 Or Col = 16 Or Col = 17 Then
Col = 14
End If
End If
'Col = Col + 1
If (Shi > "00:00" And Shi < "00:59") Or Shi = "00:00" Then '是否跨日
BiJiaoShijian = DateDiff("h", Shi, Shi1)
If BiJiaoShijian > 11 Then
If xlSheet.Cells(Row - 1, Col) = "" Then
xlSheet.Cells(Row - 1, Col) = Shi
Else
If xlSheet.Cells(Row - 1, Col + 1) = "" Then
xlSheet.Cells(Row - 1, Col + 1) = Shi
Else
If xlSheet.Cells(Row - 1, Col + 2) = "" Then
xlSheet.Cells(Row - 1, Col + 2) = Shi
Else
xlSheet.Cells(Row - 1, Col + 3) = Shi
End If
End If
End If
Else
xlSheet.Cells(Row, Col) = Shi
End If
Else
If xlSheet.Cells(Row, Col).Value = "" Then
xlSheet.Cells(Row, Col).Value = Shi 'CStr(Mid(Rst("sbshijian"), 1, 5)) 'Str(Rst("sbshijian").Value)
Else
xlSheet.Cells(Row, Col + 1).Value = Shi
End If
End If
If (Shi1 > "23:00" And Shi1 < "23:59") Or Shi1 = "00:00" Then
BiJiaoShijian = DateDiff("h", Shi, Shi1)
If BiJiaoShijian < 11 And BiJiaoShijian > 8 Then
xlSheet.Cells(Row, Col + 1) = Shi1
Else
If BiJiaoShijian = 8 Or BiJiaoShijian < 8 Then
If xlSheet.Cells(Row, Col + 1) = "" Then
xlSheet.Cells(Row, Col + 1) = Shi1
Else
If xlSheet.Cells(Row, Col + 2) = "" Then
xlSheet.Cells(Row, Col + 2) = Shi1
Else
xlSheet.Cells(Row, Col + 3) = Shi1
End If
End If
Else
xlSheet.Cells(Row + 1, Col) = Shi1
End If
End If
Else
If xlSheet.Cells(Row, Col) = "" Then
xlSheet.Cells(Row, Col) = Shi1
Else
xlSheet.Cells(Row, Col + 1) = Shi1
End If
End If
'If xlSheet.Cells(Row, Col).Value = "" Then
' xlSheet.Cells(Row, Col).Value = Shi 'CStr(Mid(Rst("sbshijian"), 1, 5)) 'Str(Rst("sbshijian").Value)
'Else
' xlSheet.Cells(Row, Col + 1).Value = Shi
'End If
Rst.MoveNext
'Row = Row + 1
'Col = Col - 1
End If
If Rst.RecordCount >= 5 Then
'EndTime = Left(Rst!Shijian, 2)
'If EndTime = "00" Then
' Col = Col + 3
' Shi = Format(Rst("shijian"), "hh:mm")
' xlSheet.Cells(Row, Col).Value = Shi
' Col = Col - 3
' End If
' Rst.MoveNext
Shi = Format(Rst("shijian"), "hh:mm")
Rst.MoveNext
Shi1 = Format(Rst("shijian"), "hh:mm")
Rst.MoveNext
Shi3 = Format(Rst("shijian"), "hh:mm")
Rst.MoveNext
Shi4 = Format(Rst("shijian"), "hh:mm")
Rst.MoveNext
Shi5 = Format(Rst("shijian"), "hh:mm")
Row = Row + 1
If (Shi > "00:00" And Shi < "23:59") Or Shi = "00:00" Then
If xlSheet.Cells(Row - 1, Col).Value = "" Then
xlSheet.Cells(Row - 1, Col).Value = Shi
Else
If xlSheet.Cells(Row - 1, Col + 1).Value = "" Then
xlSheet.Cells(Row - 1, Col + 1).Value = Shi
Else
If xlSheet.Cells(Row - 1, Col + 2).Value = "" Then
xlSheet.Cells(Row - 1, Col + 2).Value = Shi
Else
xlSheet.Cells(Row - 1, Col + 3).Value = Shi
End If
End If
End If
Else
xlSheet.Cells(Row, Col).Value = Shi
End If
If xlSheet.Cells(Row, Col) = "" Then
xlSheet.Cells(Row, Col) = Shi1
Else
xlSheet.Cells(Row, Col + 1) = Shi1
End If
If xlSheet.Cells(Row, Col + 1) = "" Then
xlSheet.Cells(Row, Col + 1) = Shi3
Else
xlSheet.Cells(Row, Col + 2) = Shi3
End If
If xlSheet.Cells(Row, Col + 2) = "" Then
xlSheet.Cells(Row, Col + 2) = Shi4
Else
xlSheet.Cells(Row, Col + 3) = Shi4
End If
If xlSheet.Cells(Row, Col + 2) = "" Then
xlSheet.Cells(Row, Col + 2) = Shi5
Else
xlSheet.Cells(Row, Col + 3) = Shi5
End If
End If
If Rst.RecordCount = 4 Then
Shi = Format(Rst("shijian"), "hh:mm")
Rst.MoveNext
Shi1 = Format(Rst("shijian"), "hh:mm")
Rst.MoveNext
Shi3 = Format(Rst("shijian"), "hh:mm")
Rst.MoveNext
Shi4 = Format(Rst("shijian"), "hh:mm")
Row = Row + 1
If (Shi > "00:00" And Shi < "00:59") Or Shi = "00:00" Then
If xlSheet.Cells(Row - 1, Col).Value = "" Then
xlSheet.Cells(Row - 1, Col).Value = Shi
Else
If xlSheet.Cells(Row - 1, Col + 1).Value = "" Then
xlSheet.Cells(Row - 1, Col + 1).Value = Shi
Else
If xlSheet.Cells(Row - 1, Col).Value = "" Then
xlSheet.Cells(Row - 1, Col + 2).Value = Shi
Else
xlSheet.Cells(Row - 1, Col + 3).Value = Shi
End If
End If
End If
Else
xlSheet.Cells(Row, Col).Value = Shi
End If
If xlSheet.Cells(Row, Col) = "" Then
xlSheet.Cells(Row, Col) = Shi1
Else
xlSheet.Cells(Row, Col + 1) = Shi1
End If
If xlSheet.Cells(Row, Col + 1) = "" Then
xlSheet.Cells(Row, Col + 1) = Shi3
Else
If xlSheet.Cells(Row, Col + 2) = "" Then
xlSheet.Cells(Row, Col + 2) = Shi3
End If
End If
If xlSheet.Cells(Row, Col + 2) = "" Then
xlSheet.Cells(Row, Col + 2) = Shi4
Else
xlSheet.Cells(Row, Col + 3) = Shi4
End If
'Row = Row + 1
End If
If Rst.RecordCount = 3 Then
Shi = Format(Rst("shijian"), "hh:mm")
Rst.MoveNext
Shi1 = Format(Rst("shijian"), "hh:mm")
Rst.MoveNext
Shi3 = Format(Rst("shijian"), "hh:mm")
Row = Row + 1
'CheKuaRi
If (Shi > "00:00" And Shi < "00:59") Or Shi = "00:00" Then '是否跨日
KSJ = DateDiff("h", Shi, Shi1)
If KSJ > 11 Then
If xlSheet.Cells(Row - 1, Col).Value = "" Then
xlSheet.Cells(Row - 1, Col).Value = Shi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -