📄 frm关口电量.frm
字号:
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
End With
sendexcel.Range("C3:G3").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:=9).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:=11, 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("H3:L3").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:=8).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:=10, 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("C3:G3").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("H3:L3").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("M3:Q3").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("S3:W3").Select
sendexcel.ActiveWindow.ScrollColumn = 14
sendexcel.ActiveCell.FormulaR1C1 = "电量"
sendexcel.Range("S3:W3").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("T9").Select
sendexcel.ActiveWindow.ScrollColumn = 5
sendexcel.ActiveWindow.ScrollColumn = 1
sendexcel.Range("A2:W2").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 * from xdgl_jsb where type='关口' and jlff='入'"
Set RS = ZHCX.Execute(sql1, 1)
j = 5
If Not RS.EOF Then
sendexcel.Cells(1, 1).Value = Trim(RS(0)) + Format(DTPicker1.Value, "yyyy-mm-dd") + "日(有功)电量统计报表"
Do While Not RS.EOF
sendexcel.Cells(j, 1).Value = Trim(RS("jlgk"))
sendexcel.Cells(j, 2).Value = Trim(RS("jlff"))
sendexcel.Cells(j, 18).Value = Trim(RS("bl"))
sql1 = "select * from xdgl_ddyb_rdl where rq='" & DTPicker1.Value & "' and dllx='止码' and gk='" & Trim(RS("jlgk")) & "'"
Debug.Print sql1
Set RS1 = ZHCX.Execute(sql1, 1)
Do While Not RS1.EOF
sendexcel.Cells(j, 3).Value = RS1("d_1")
sendexcel.Cells(j, 4).Value = RS1("d_2")
sendexcel.Cells(j, 5).Value = RS1("d_3")
sendexcel.Cells(j, 6).Value = RS1("d_4")
sendexcel.Cells(j, 7).Value = RS1("d_z")
RS1.MoveNext
Loop
If RS1.State Then
RS1.Close
End If
sql1 = "select * from xdgl_ddyb_rdl where rq='" & Format(DTPicker1.Value, "yyyy-mm-01") & "' and dllx='起码' and gk='" & Trim(RS("jlgk")) & "'"
Set RS1 = ZHCX.Execute(sql1, 1)
Do While Not RS1.EOF
sendexcel.Cells(j, 8).Value = RS1("d_1")
sendexcel.Cells(j, 9).Value = RS1("d_2")
sendexcel.Cells(j, 10).Value = RS1("d_3")
sendexcel.Cells(j, 11).Value = RS1("d_4")
sendexcel.Cells(j, 12).Value = RS1("d_z")
RS1.MoveNext
Loop
If RS1.State Then
RS1.Close
End If
sendexcel.Cells(j, 13).Value = "=c" & CStr(j) & "-h" & CStr(j) & ""
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, 19).Value = "=m" & CStr(j) & "*r" & CStr(j) & ""
sendexcel.Cells(j, 20).Value = "=n" & CStr(j) & "*r" & CStr(j) & ""
sendexcel.Cells(j, 21).Value = "=o" & CStr(j) & "*r" & CStr(j) & ""
sendexcel.Cells(j, 22).Value = "=p" & CStr(j) & "*r" & CStr(j) & ""
sendexcel.Cells(j, 23).Value = "=q" & CStr(j) & "*r" & CStr(j) & ""
If RS1.State Then
RS1.Close
End If
RS.MoveNext
j = j + 1
Loop
End If
If Err Then Err.Clear
If RS.State Then
RS.Close
End If
sendexcel.Cells(j, 1).Value = "小计"
sendexcel.Cells(j, 2).Value = "入"
sendexcel.Cells(j, 2).Value = "入"
sendexcel.Cells(j, 19).Value = "=sum(s5:s" & CStr(j - 1) & ")"
sendexcel.Cells(j, 20).Value = "=sum(t5:t" & CStr(j - 1) & ")"
sendexcel.Cells(j, 21).Value = "=sum(u5:u" & CStr(j - 1) & ")"
sendexcel.Cells(j, 22).Value = "=sum(v5:v" & CStr(j - 1) & ")"
sendexcel.Cells(j, 23).Value = "=sum(w5:w" & CStr(j - 1) & ")"
j = j + 1
temp = j - 1
sql1 = "select * from xdgl_jsb where type='关口' and jlff='出'"
Set RS = ZHCX.Execute(sql1, 1)
If Not RS.EOF Then
Do While Not RS.EOF
sendexcel.Cells(j, 1).Value = Trim(RS("jlgk"))
sendexcel.Cells(j, 2).Value = Trim(RS("jlff"))
sendexcel.Cells(j, 18).Value = Trim(RS("bl"))
For i = 0 To 3
sql1 = "select * from xdgl_ddyb_rdl where rq='" & DTPicker1.Value & "' and dllx='" & b(i) & "' and gk='" & Trim(RS("jlgk")) & "'"
Set RS1 = ZHCX.Execute(sql1, 1)
Select Case i
Case 0
Do While Not RS1.EOF
sendexcel.Cells(j, 3).Value = RS1("d_1")
sendexcel.Cells(j, 4).Value = RS1("d_2")
sendexcel.Cells(j, 5).Value = RS1("d_3")
sendexcel.Cells(j, 6).Value = RS1("d_4")
sendexcel.Cells(j, 7).Value = RS1("d_z")
RS1.MoveNext
Loop
Case 1
Do While Not RS1.EOF
sendexcel.Cells(j, 8).Value = RS1("d_1")
sendexcel.Cells(j, 9).Value = RS1("d_2")
sendexcel.Cells(j, 10).Value = RS1("d_3")
sendexcel.Cells(j, 11).Value = RS1("d_4")
sendexcel.Cells(j, 12).Value = RS1("d_z")
RS1.MoveNext
Loop
Case 2
sendexcel.Cells(j, 13).Value = "=c" & CStr(j) & "-h" & CStr(j) & ""
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).Valu
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -