📄 frm电量平衡.frm
字号:
.ColorIndex = xlAutomatic
End With
With sendexcel.ActiveCell.Characters(Start:=2, Length:=10).Font
.Name = "Times New Roman"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With sendexcel.ActiveCell.Characters(Start:=12, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
sendexcel.Range("i3:m3").Select
sendexcel.ActiveCell.FormulaR1C1 = "起 码"
With sendexcel.ActiveCell.Characters(Start:=1, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With sendexcel.ActiveCell.Characters(Start:=2, Length:=10).Font
.Name = "Times New Roman"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With sendexcel.ActiveCell.Characters(Start:=12, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
sendexcel.Range("n3:r3").Select
sendexcel.ActiveCell.FormulaR1C1 = "表 码"
With sendexcel.ActiveCell.Characters(Start:=1, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With sendexcel.ActiveCell.Characters(Start:=2, Length:=10).Font
.Name = "Times New Roman"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With sendexcel.ActiveCell.Characters(Start:=12, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
sendexcel.Range("t3:x3").Select
sendexcel.ActiveWindow.ScrollColumn = 14
sendexcel.ActiveCell.FormulaR1C1 = "电量"
sendexcel.Range("t3:x3").Select
sendexcel.ActiveCell.FormulaR1C1 = "电 量"
With sendexcel.ActiveCell.Characters(Start:=1, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With sendexcel.ActiveCell.Characters(Start:=2, Length:=10).Font
.Name = "Times New Roman"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With sendexcel.ActiveCell.Characters(Start:=12, Length:=1).Font
.Name = "宋体"
.FontStyle = "常规"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
sendexcel.Range("u9").Select
sendexcel.ActiveWindow.ScrollColumn = 5
sendexcel.ActiveWindow.ScrollColumn = 1
sendexcel.Range("A2:x2").Select
sendexcel.Selection.Merge
With sendexcel.Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
sendexcel.ActiveWindow.LargeScroll ToRight:=1
b(0) = "止码"
b(1) = "起码"
b(2) = "表码"
b(3) = "电量"
If RS.State Then
RS.Close
End If
sql1 = "select distinct bdz from xdgl_jld"
If RS4.State Then
RS4.Close
End If
j = 5
Set RS4 = ZHCX.Execute(sql1, 1)
Do While Not RS4.EOF
temp_start = j
sql1 = "select * from xdgl_jld where bdz='" & Trim(RS4(0)) & "' and jlff='入' and dydj='" & Trim(Combo3.Text) & "'"
Set RS = ZHCX.Execute(sql1, 1)
If Not RS.EOF Then
sendexcel.Cells(1, 1).Value = Trim(RS(0)) + Trim(Combo3.Text) + "电量平衡统计报表" + Format(DTPicker1.Value, "yyyy年mm月")
Do While Not RS.EOF
sendexcel.Cells(j, 2).Value = Trim(RS("jld"))
sendexcel.Cells(j, 3).Value = Trim(RS("jlff"))
sendexcel.Cells(j, 19).Value = Trim(RS("bl"))
For i = 0 To 3
sql1 = "select * from xdgl_dlph where rq='" & DTPicker1.Value & "' and dllx='" & b(i) & "' and jld='" & Trim(RS("jld")) & "' and bdz='" & Trim(RS4(0)) & "' and dydj='" & Trim(Combo3.Text) & "'"
Set RS1 = ZHCX.Execute(sql1, 1)
Select Case i
Case 0
Do While Not RS1.EOF
sendexcel.Cells(j, 4).Value = RS1("d_1")
sendexcel.Cells(j, 5).Value = RS1("d_2")
sendexcel.Cells(j, 6).Value = RS1("d_3")
sendexcel.Cells(j, 7).Value = RS1("d_4")
sendexcel.Cells(j, 8).Value = RS1("d_z")
RS1.MoveNext
Loop
Case 1
Do While Not RS1.EOF
sendexcel.Cells(j, 9).Value = RS1("d_1")
sendexcel.Cells(j, 10).Value = RS1("d_2")
sendexcel.Cells(j, 11).Value = RS1("d_3")
sendexcel.Cells(j, 12).Value = RS1("d_4")
sendexcel.Cells(j, 13).Value = RS1("d_z")
RS1.MoveNext
Loop
Case 2
sendexcel.Cells(j, 14).Value = "=d" & CStr(j) & "-i" & CStr(j) & ""
sendexcel.Cells(j, 15).Value = "=e" & CStr(j) & "-j" & CStr(j) & ""
sendexcel.Cells(j, 16).Value = "=f" & CStr(j) & "-k" & CStr(j) & ""
sendexcel.Cells(j, 17).Value = "=g" & CStr(j) & "-l" & CStr(j) & ""
sendexcel.Cells(j, 18).Value = "=h" & CStr(j) & "-m" & CStr(j) & ""
Case 3
sendexcel.Cells(j, 20).Value = "=n" & CStr(j) & "*s" & CStr(j) & ""
sendexcel.Cells(j, 21).Value = "=o" & CStr(j) & "*s" & CStr(j) & ""
sendexcel.Cells(j, 22).Value = "=p" & CStr(j) & "*s" & CStr(j) & ""
sendexcel.Cells(j, 23).Value = "=q" & CStr(j) & "*s" & CStr(j) & ""
sendexcel.Cells(j, 24).Value = "=r" & CStr(j) & "*s" & CStr(j) & ""
End Select
If RS1.State Then
RS1.Close
End If
Next i
RS.MoveNext
j = j + 1
Loop
End If
If Err Then Err.Clear
If RS.State Then
RS.Close
End If
sendexcel.Cells(j, 2).Value = "小计"
sendexcel.Cells(j, 3).Value = "入"
sendexcel.Cells(j, 20).Value = "=sum(t" & CStr(temp_start) & ":t" & CStr(j - 1) & ")"
sendexcel.Cells(j, 21).Value = "=sum(u" & CStr(temp_start) & ":u" & CStr(j - 1) & ")"
sendexcel.Cells(j, 22).Value = "=sum(v" & CStr(temp_start) & ":v" & CStr(j - 1) & ")"
sendexcel.Cells(j, 23).Value = "=sum(w" & CStr(temp_start) & ":w" & CStr(j - 1) & ")"
sendexcel.Cells(j, 24).Value = "=sum(x" & CStr(temp_start) & ":x" & CStr(j - 1) & ")"
j = j + 1
temp = j - 1
sql1 = "select * from xdgl_jld where bdz='" & Trim(RS4(0)) & "' and jlff='出'"
Set RS = ZHCX.Execute(sql1, 1)
If Not RS.EOF Then
Do While Not RS.EOF
sendexcel.Cells(j, 2).Value = Trim(RS("jld"))
sendexcel.Cells(j, 3).Value = Trim(RS("jlff"))
sendexcel.Cells(j, 19).Value = Trim(RS("bl"))
For i = 0 To 3
sql1 = "select * from xdgl_dlph where rq='" & DTPicker1.Value & "' and dllx='" & b(i) & "' and jld='" & Trim(RS("jld")) & "' and bdz='" & Trim(RS4(0)) & "'"
Set RS1 = ZHCX.Execute(sql1, 1)
Select Case i
Case 0
Do While Not RS1.EOF
sendexcel.Cells(j, 4).Value = RS1("d_1")
sendexcel.Cells(j, 5).Value = RS1("d_2")
sendexcel.Cells(j, 6).Value = RS1("d_3")
sendexcel.Cells(j, 7).Value = RS1("d_4")
sendexcel.Cells(j, 8).Value = RS1("d_z")
RS1.MoveNext
Loop
Case 1
Do While Not RS1.EOF
sendexcel.Cells(j, 9).Value = RS1("d_1")
sendexcel.Cells(j, 10).Value = RS1("d_2")
sendexcel.Cells(j, 11).Value = RS1("d_3")
sendexcel.Cells(j, 12).Value = RS1("d_4")
sendexcel.Cells(j, 13).Value = RS1("d_z")
RS1.MoveNext
Loop
Case 2
sendexcel.Cells(j, 14).Value = "=d" & CStr(j) & "-i" & CStr(j) & ""
sendexcel.Cells(j, 15).Value = "=e" & CStr(j) & "-j" & CStr(j) & ""
sendexcel.Cells(j, 16).Value = "=f" & CStr(j) & "-k" & CStr(j) & ""
sendexcel.Cells(j, 17).Value = "=g" & CStr(j) & "-l" & CStr(j) & ""
sendexcel.Cells(j, 18).Value = "=h" & CStr(j) & "-m" & CStr(j) & ""
Case 3
sendexcel.Cells(j, 20).Value = "=n" & CStr(j) & "*s" & CStr(j) & ""
sendexcel.Cells(j, 21).Value = "=o" & CStr(j) & "*s" & CStr(j) & ""
sendexcel.Cells(j, 22).Value = "=p" & CStr(j) & "*s" & CStr(j) & ""
sendexcel.Cells(j, 23).Value = "=q" & CStr(j) & "*s" & CStr(j) & ""
sendexcel.Cells(j, 24).Value = "=r" & CStr(j) & "*s" & CStr(j) & ""
End Select
If RS1.State Then
RS1.Close
End If
Next i
RS.MoveNext
j = j + 1
Loop
End If
If Err Then Err.Clear
If RS.State Then
RS.Close
End If
If temp <> (j - 1) Then
sendexcel.Cells(j, 2).Value = "小计"
sendexcel.Cells(j, 3).Value = "出"
sendexcel.Cells(j, 20).Value = "=sum(t" & CStr(temp + 1) & ":t" & CStr(j - 1) & ")"
sendexcel.Cells(j, 21).Value = "=sum(u" & CStr(temp + 1) & ":u" & CStr(j - 1) & ")"
sendexcel.Cells(j, 22).Value = "=sum(v" & CStr(temp + 1) & ":v" & CStr(j - 1) & ")"
sendexcel.Cells(j, 23).Value = "=sum(w" & CStr(temp + 1) & ":w" & CStr(j - 1) & ")"
sendexcel.Cells(j, 24).Value = "=sum(x" & CStr(temp + 1) & ":x" & CStr(j - 1) & ")"
j = j + 1
sendexcel.Cells(j, 2).Value = "不平衡电量"
sendexcel.Cells(j, 3).Value = ""
'sendexcel.Cells(j, 20).Value = "=t" & CStr(temp) & "-t" & CStr(j - 1) & ""
'sendexcel.Cells(j, 21).Value = "=u" & CStr(temp) & "-u" & CStr(j - 1) & ""
'sendexcel.Cells(j, 22).Value = "=v" & CStr(temp) & "-v" & CStr(j - 1) & ""
'sendexcel.Cells(j, 23).Value = "=w" & CStr(temp) & "-w" & CStr(j - 1) & ""
sendexcel.Cells(j, 24).Value = "=x" & CStr(temp) & "-x" & CStr(j - 1) & ""
j = j + 1
sendexcel.Cells(j, 2).Value = "不平衡率"
sendexcel.Cells(j, 3).Value = ""
sendexcel.Cells(j, 24).Value = "=x" & CStr(j - 1) & "/x" & CStr(temp)
j = j + 1
Else
sendexcel.Cells(j, 2).Value = "不平衡电量"
sendexcel.Cells(j, 3).Value = ""
sendexcel.Cells(j, 20).Value = "=t" & CStr(temp + 1)
sendexcel.Cells(j, 21).Value = "=u" & CStr(temp + 1)
sendexcel.Cells(j, 22).Value = "=v" & CStr(temp + 1)
sendexcel.Cells(j, 23).Value = "=w" & CStr(temp + 1)
sendexcel.Cells(j, 24).Value = "=x" & CStr(temp + 1)
j = j + 1
sendexcel.Cells(j, 2).Value = "不平衡率"
sendexcel.Cells(j, 3).Value = ""
sendexcel.Cells(j, 24).Value = "=x" & CStr(temp + 1)
j = j + 1
End If
s_a = "A" & CStr(temp_start) & ":A" & CStr(j - 1)
sendexcel.Range(s_a).Select
sendexcel.Application.CutCopyMode = False
With sendexcel.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
sendexcel.Selection.Merge
sendexcel.Selection.Value = Trim(RS4(0))
RS4.MoveNext
Loop
If RS4.State Then
RS4.Close
End If
sendexcel.Columns("C:X").Select
sendexcel.Selection.ColumnWidth = 8
sendexcel.Columns("A:A").ColumnWidth = 8
sendexcel.Columns("B:B").ColumnWidth = 8
s_a = "A1:X" & CStr(j - 1)
sendexcel.Range(s_a).Select
sendexcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone
sendexcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With sendexcel.Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -