ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 158|回复: 5

帮忙优化代码,vb小白

[复制链接]

TA的精华主题

TA的得分主题

发表于 2024-5-30 21:33 | 显示全部楼层 |阅读模式
1
sub 计算()
Dim ws As Worksheet
    Set ws = Worksheets("TANK TABLE")
     ws.Unprotect Password:="`111111"
   Worksheets("TANK TABLE").Cells(9, 6).Value = Worksheets("1P").Cells(33, 2).Value
     Worksheets("TANK TABLE").Cells(10, 6).Value = Worksheets("1S").Cells(33, 2).Value
     Worksheets("TANK TABLE").Cells(11, 6).Value = Worksheets("2P").Cells(33, 2).Value
      Worksheets("TANK TABLE").Cells(12, 6).Value = Worksheets("2S").Cells(33, 2).Value
      Worksheets("TANK TABLE").Cells(13, 6).Value = Worksheets("3S").Cells(33, 2).Value
     Worksheets("TANK TABLE").Cells(14, 6).Value = Worksheets("3P").Cells(33, 2).Value
    Worksheets("TANK TABLE").Cells(15, 6).Value = Worksheets("OVFL").Cells(33, 2).Value
     Worksheets("TANK TABLE").Cells(23, 6).Value = Worksheets("DOP").Cells(33, 2).Value
    Worksheets("TANK TABLE").Cells(24, 6).Value = Worksheets("DOS").Cells(33, 2).Value
   Worksheets("TANK TABLE").Range("I9").Formula = "=IF(G9=0,0,INDEX('TABLE 54B'!A$1:W$105,H9+5,100*ROUND(G9,2)-78,1))"
Worksheets("TANK TABLE").Range("I10").Formula = "=IF(G10=0,0,INDEX('TABLE 54B'!A$1:W$105,H10+5,100*ROUND(G10,2)-78,1))"
Worksheets("TANK TABLE").Range("I11").Formula = "=IF(G11=0,0,INDEX('TABLE 54B'!A$1:W$105,H11+5,100*ROUND(G11,2)-78,1))"
Worksheets("TANK TABLE").Range("I12").Formula = "=IF(G12=0,0,INDEX('TABLE 54B'!A$1:W$105,H12+5,100*ROUND(G12,2)-78,1))"
Worksheets("TANK TABLE").Range("I13").Formula = "=IF(G13=0,0,INDEX('TABLE 54B'!A$1:W$105,H13+5,100*ROUND(G13,2)-78,1))"
Worksheets("TANK TABLE").Range("I14").Formula = "=IF(G14=0,0,INDEX('TABLE 54B'!A$1:W$105,H14+5,100*ROUND(G14,2)-78,1))"
Worksheets("TANK TABLE").Range("I15").Formula = "=IF(G15=0,0,INDEX('TABLE 54B'!A$1:W$105,H15+5,100*ROUND(G15,2)-78,1))"
Worksheets("TANK TABLE").Range("I16").Formula = "=IF(G16=0,0,INDEX('TABLE 54B'!A$1:W$105,H16+5,100*ROUND(G16,2)-78,1))"
Worksheets("TANK TABLE").Range("I17").Formula = "=IF(G17=0,0,INDEX('TABLE 54B'!A$1:W$105,H17+5,100*ROUND(G17,2)-78,1))"
Worksheets("TANK TABLE").Range("I18").Formula = "=IF(G18=0,0,INDEX('TABLE 54B'!A$1:W$105,H18+5,100*ROUND(G18,2)-78,1))"
Worksheets("TANK TABLE").Range("I23").Formula = "=IF(G23=0,0,INDEX('TABLE 54B'!A$1:W$105,H23+5,100*ROUND(G23,2)-78,1))"
Worksheets("TANK TABLE").Range("I24").Formula = "=IF(G24=0,0,INDEX('TABLE 54B'!A$1:W$105,H24+5,100*ROUND(G24,2)-78,1))"
Worksheets("TANK TABLE").Range("I25").Formula = "=IF(G25=0,0,INDEX('TABLE 54B'!A$1:W$105,H25+5,100*ROUND(G25,2)-78,1))"
Worksheets("TANK TABLE").Range("I26").Formula = "=IF(G26=0,0,INDEX('TABLE 54B'!A$1:W$105,H26+5,100*ROUND(G26,2)-78,1))"
  Worksheets("TANK TABLE").Range("K9").Formula = "=F9*I9*(G9-0.0011)"
Worksheets("TANK TABLE").Range("K10").Formula = "=F10*I10*(G10-0.0011)"
Worksheets("TANK TABLE").Range("K11").Formula = "=F11*I11*(G11-0.0011)"
Worksheets("TANK TABLE").Range("K12").Formula = "=F12*I12*(G12-0.0011)"
Worksheets("TANK TABLE").Range("K13").Formula = "=F13*I13*(G13-0.0011)"
Worksheets("TANK TABLE").Range("K14").Formula = "=F14*I14*(G14-0.0011)"
Worksheets("TANK TABLE").Range("K15").Formula = "=F15*I15*(G15-0.0011)"
Worksheets("TANK TABLE").Range("K16").Formula = "=F16*I16*(G16-0.0011)"
Worksheets("TANK TABLE").Range("K17").Formula = "=F17*I17*(G17-0.0011)"
Worksheets("TANK TABLE").Range("K18").Formula = "=F18*I18*(G18-0.0011)"
Worksheets("TANK TABLE").Range("K23").Formula = "=F23*I23*(G23-0.0011)"
Worksheets("TANK TABLE").Range("K24").Formula = "=F24*I24*(G24-0.0011)"
Worksheets("TANK TABLE").Range("K25").Formula = "=F25*I25*(G25-0.0011)"
Worksheets("TANK TABLE").Range("K26").Formula = "=F26*I26*(G26-0.0011)"
Worksheets("TANK TABLE").Range("J30").Formula = "=H30-H29"
Worksheets("TANK TABLE").Range("E29").Formula = "= K19- D29"
Worksheets("TANK TABLE").Range("E30").Formula = "= K27-D30 "
    ' 运行原有代码
     ws.Protect Password:="`111111"

End Sub


3

Sub 恢复()
  Dim ws As Worksheet
    Set ws = Worksheets("TANK TABLE")
    ws.Unprotect Password:="`111111"
    Worksheets("测量记录").Activate
   n = Selection.Row
Worksheets("TANK TABLE").Cells(2, 11).Value = Worksheets("测量记录").Cells(n, 1).Value
Worksheets("TANK TABLE").Cells(2, 2).Value = Worksheets("测量记录").Cells(n, 2).Value
Worksheets("TANK TABLE").Cells(9, 5).Value = Worksheets("测量记录").Cells(n, 3).Value
Worksheets("TANK TABLE").Cells(10, 5).Value = Worksheets("测量记录").Cells(n, 4).Value
Worksheets("TANK TABLE").Cells(11, 5).Value = Worksheets("测量记录").Cells(n, 5).Value
Worksheets("TANK TABLE").Cells(12, 5).Value = Worksheets("测量记录").Cells(n, 6).Value
Worksheets("TANK TABLE").Cells(13, 5).Value = Worksheets("测量记录").Cells(n, 7).Value
Worksheets("TANK TABLE").Cells(14, 5).Value = Worksheets("测量记录").Cells(n, 8).Value
Worksheets("TANK TABLE").Cells(15, 5).Value = Worksheets("测量记录").Cells(n, 9).Value
Worksheets("TANK TABLE").Cells(16, 6).Value = Worksheets("测量记录").Cells(n, 10).Value
Worksheets("TANK TABLE").Cells(17, 6).Value = Worksheets("测量记录").Cells(n, 11).Value
Worksheets("TANK TABLE").Cells(18, 6).Value = Worksheets("测量记录").Cells(n, 12).Value
Worksheets("TANK TABLE").Cells(23, 5).Value = Worksheets("测量记录").Cells(n, 13).Value
Worksheets("TANK TABLE").Cells(24, 5).Value = Worksheets("测量记录").Cells(n, 14).Value
Worksheets("TANK TABLE").Cells(25, 5).Value = Worksheets("测量记录").Cells(n, 15).Value
Worksheets("TANK TABLE").Cells(26, 6).Value = Worksheets("测量记录").Cells(n, 16).Value
Worksheets("TANK TABLE").Cells(9, 7).Value = Worksheets("测量记录").Cells(n, 17).Value
Worksheets("TANK TABLE").Cells(10, 7).Value = Worksheets("测量记录").Cells(n, 18).Value
Worksheets("TANK TABLE").Cells(11, 7).Value = Worksheets("测量记录").Cells(n, 19).Value
Worksheets("TANK TABLE").Cells(12, 7).Value = Worksheets("测量记录").Cells(n, 20).Value
Worksheets("TANK TABLE").Cells(13, 7).Value = Worksheets("测量记录").Cells(n, 21).Value
Worksheets("TANK TABLE").Cells(14, 7).Value = Worksheets("测量记录").Cells(n, 22).Value
Worksheets("TANK TABLE").Cells(15, 7).Value = Worksheets("测量记录").Cells(n, 23).Value
Worksheets("TANK TABLE").Cells(16, 7).Value = Worksheets("测量记录").Cells(n, 24).Value
Worksheets("TANK TABLE").Cells(17, 7).Value = Worksheets("测量记录").Cells(n, 25).Value
Worksheets("TANK TABLE").Cells(18, 7).Value = Worksheets("测量记录").Cells(n, 26).Value
Worksheets("TANK TABLE").Cells(23, 7).Value = Worksheets("测量记录").Cells(n, 27).Value
Worksheets("TANK TABLE").Cells(24, 7).Value = Worksheets("测量记录").Cells(n, 28).Value
Worksheets("TANK TABLE").Cells(25, 7).Value = Worksheets("测量记录").Cells(n, 29).Value
Worksheets("TANK TABLE").Cells(26, 7).Value = Worksheets("测量记录").Cells(n, 30).Value
Worksheets("TANK TABLE").Cells(9, 8).Value = Worksheets("测量记录").Cells(n, 31).Value
Worksheets("TANK TABLE").Cells(10, 8).Value = Worksheets("测量记录").Cells(n, 32).Value
Worksheets("TANK TABLE").Cells(11, 8).Value = Worksheets("测量记录").Cells(n, 33).Value
Worksheets("TANK TABLE").Cells(12, 8).Value = Worksheets("测量记录").Cells(n, 34).Value
Worksheets("TANK TABLE").Cells(13, 8).Value = Worksheets("测量记录").Cells(n, 35).Value
Worksheets("TANK TABLE").Cells(14, 8).Value = Worksheets("测量记录").Cells(n, 36).Value
Worksheets("TANK TABLE").Cells(15, 8).Value = Worksheets("测量记录").Cells(n, 37).Value
Worksheets("TANK TABLE").Cells(16, 8).Value = Worksheets("测量记录").Cells(n, 38).Value
Worksheets("TANK TABLE").Cells(17, 8).Value = Worksheets("测量记录").Cells(n, 39).Value
Worksheets("TANK TABLE").Cells(18, 8).Value = Worksheets("测量记录").Cells(n, 40).Value
Worksheets("TANK TABLE").Cells(23, 8).Value = Worksheets("测量记录").Cells(n, 41).Value
Worksheets("TANK TABLE").Cells(24, 8).Value = Worksheets("测量记录").Cells(n, 42).Value
Worksheets("TANK TABLE").Cells(25, 8).Value = Worksheets("测量记录").Cells(n, 43).Value
Worksheets("TANK TABLE").Cells(26, 8).Value = Worksheets("测量记录").Cells(n, 44).Value
Worksheets("TANK TABLE").Cells(29, 4).Value = Worksheets("测量记录").Cells(n, 45).Value
Worksheets("TANK TABLE").Cells(30, 4).Value = Worksheets("测量记录").Cells(n, 46).Value
Worksheets("TANK TABLE").Cells(29, 8).Value = Worksheets("测量记录").Cells(n, 47).Value
Worksheets("TANK TABLE").Cells(30, 8).Value = Worksheets("测量记录").Cells(n, 48).Value
Worksheets("TANK TABLE").Cells(29, 10).Value = Worksheets("测量记录").Cells(n, 49).Value
Worksheets("TANK TABLE").Cells(30, 10).Value = Worksheets("测量记录").Cells(n, 50).Value
Worksheets("TANK TABLE").Cells(29, 12).Value = Worksheets("测量记录").Cells(n, 51).Value
Worksheets("TANK TABLE").Cells(30, 12).Value = Worksheets("测量记录").Cells(n, 52).Value
Worksheets("TANK TABLE").Cells(9, 12).Value = Worksheets("测量记录").Cells(n, 53).Value
Worksheets("TANK TABLE").Cells(10, 12).Value = Worksheets("测量记录").Cells(n, 54).Value
Worksheets("TANK TABLE").Cells(11, 12).Value = Worksheets("测量记录").Cells(n, 55).Value
Worksheets("TANK TABLE").Cells(12, 12).Value = Worksheets("测量记录").Cells(n, 56).Value
Worksheets("TANK TABLE").Cells(13, 12).Value = Worksheets("测量记录").Cells(n, 57).Value
Worksheets("TANK TABLE").Cells(14, 12).Value = Worksheets("测量记录").Cells(n, 58).Value
Worksheets("TANK TABLE").Cells(15, 12).Value = Worksheets("测量记录").Cells(n, 59).Value
Worksheets("TANK TABLE").Cells(16, 12).Value = Worksheets("测量记录").Cells(n, 60).Value
Worksheets("TANK TABLE").Cells(17, 12).Value = Worksheets("测量记录").Cells(n, 61).Value
Worksheets("TANK TABLE").Cells(18, 12).Value = Worksheets("测量记录").Cells(n, 62).Value
Worksheets("TANK TABLE").Cells(23, 12).Value = Worksheets("测量记录").Cells(n, 63).Value
Worksheets("TANK TABLE").Cells(24, 12).Value = Worksheets("测量记录").Cells(n, 64).Value
Worksheets("TANK TABLE").Cells(25, 12).Value = Worksheets("测量记录").Cells(n, 65).Value
Worksheets("TANK TABLE").Cells(26, 12).Value = Worksheets("测量记录").Cells(n, 66).Value
' 运行原有代码
    ws.Protect Password:="`111111"
End Sub


TA的精华主题

TA的得分主题

 楼主| 发表于 2024-5-30 21:34 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
还有1段   2 Sub 存档()     Dim ws As Worksheet     Set ws = Worksheets("TANK TABLE")     ws.Unprotect Password:="`111111"      Sheets("测量记录").Select     Rows("3:3").Select     Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove    Worksheets("测量记录").Cells(3, 1).Value = Worksheets("TANK TABLE").Cells(2, 11).Value   Worksheets("测量记录").Cells(3, 2).Value = Worksheets("TANK TABLE").Cells(2, 2).Value   Worksheets("测量记录").Cells(3, 3).Value = Worksheets("TANK TABLE").Cells(9, 5).Value   Worksheets("测量记录").Cells(3, 4).Value = Worksheets("TANK TABLE").Cells(10, 5).Value   Worksheets("测量记录").Cells(3, 5).Value = Worksheets("TANK TABLE").Cells(11, 5).Value   Worksheets("测量记录").Cells(3, 6).Value = Worksheets("TANK TABLE").Cells(12, 5).Value   Worksheets("测量记录").Cells(3, 7).Value = Worksheets("TANK TABLE").Cells(13, 5).Value   Worksheets("测量记录").Cells(3, 8).Value = Worksheets("TANK TABLE").Cells(14, 5).Value   Worksheets("测量记录").Cells(3, 9).Value = Worksheets("TANK TABLE").Cells(15, 5).Value   Worksheets("测量记录").Cells(3, 10).Value = Worksheets("TANK TABLE").Cells(16, 6).Value   Worksheets("测量记录").Cells(3, 11).Value = Worksheets("TANK TABLE").Cells(17, 6).Value   Worksheets("测量记录").Cells(3, 12).Value = Worksheets("TANK TABLE").Cells(18, 6).Value   Worksheets("测量记录").Cells(3, 13).Value = Worksheets("TANK TABLE").Cells(23, 5).Value   Worksheets("测量记录").Cells(3, 14).Value = Worksheets("TANK TABLE").Cells(24, 5).Value   Worksheets("测量记录").Cells(3, 15).Value = Worksheets("TANK TABLE").Cells(25, 6).Value  Worksheets("测量记录").Cells(3, 16).Value = Worksheets("TANK TABLE").Cells(26, 6).Value  Worksheets("测量记录").Cells(3, 17).Value = Worksheets("TANK TABLE").Cells(9, 7).Value  Worksheets("测量记录").Cells(3, 18).Value = Worksheets("TANK TABLE").Cells(10, 7).Value  Worksheets("测量记录").Cells(3, 19).Value = Worksheets("TANK TABLE").Cells(11, 7).Value  Worksheets("测量记录").Cells(3, 20).Value = Worksheets("TANK TABLE").Cells(12, 7).Value  Worksheets("测量记录").Cells(3, 21).Value = Worksheets("TANK TABLE").Cells(13, 7).Value  Worksheets("测量记录").Cells(3, 22).Value = Worksheets("TANK TABLE").Cells(14, 7).Value  Worksheets("测量记录").Cells(3, 23).Value = Worksheets("TANK TABLE").Cells(15, 7).Value  Worksheets("测量记录").Cells(3, 24).Value = Worksheets("TANK TABLE").Cells(16, 7).Value  Worksheets("测量记录").Cells(3, 25).Value = Worksheets("TANK TABLE").Cells(17, 7).Value  Worksheets("测量记录").Cells(3, 26).Value = Worksheets("TANK TABLE").Cells(18, 7).Value  Worksheets("测量记录").Cells(3, 27).Value = Worksheets("TANK TABLE").Cells(23, 7).Value  Worksheets("测量记录").Cells(3, 28).Value = Worksheets("TANK TABLE").Cells(24, 7).Value  Worksheets("测量记录").Cells(3, 29).Value = Worksheets("TANK TABLE").Cells(25, 7).Value  Worksheets("测量记录").Cells(3, 30).Value = Worksheets("TANK TABLE").Cells(26, 7).Value Worksheets("测量记录").Cells(3, 31).Value = Worksheets("TANK TABLE").Cells(9, 8).Value  Worksheets("测量记录").Cells(3, 32).Value = Worksheets("TANK TABLE").Cells(10, 8).Value  Worksheets("测量记录").Cells(3, 33).Value = Worksheets("TANK TABLE").Cells(11, 8).Value  Worksheets("测量记录").Cells(3, 34).Value = Worksheets("TANK TABLE").Cells(12, 8).Value  Worksheets("测量记录").Cells(3, 35).Value = Worksheets("TANK TABLE").Cells(13, 8).Value  Worksheets("测量记录").Cells(3, 36).Value = Worksheets("TANK TABLE").Cells(14, 8).Value  Worksheets("测量记录").Cells(3, 37).Value = Worksheets("TANK TABLE").Cells(15, 8).Value  Worksheets("测量记录").Cells(3, 38).Value = Worksheets("TANK TABLE").Cells(16, 8).Value  Worksheets("测量记录").Cells(3, 39).Value = Worksheets("TANK TABLE").Cells(17, 8).Value  Worksheets("测量记录").Cells(3, 40).Value = Worksheets("TANK TABLE").Cells(18, 8).Value  Worksheets("测量记录").Cells(3, 41).Value = Worksheets("TANK TABLE").Cells(23, 8).Value  Worksheets("测量记录").Cells(3, 42).Value = Worksheets("TANK TABLE").Cells(24, 8).Value  Worksheets("测量记录").Cells(3, 43).Value = Worksheets("TANK TABLE").Cells(25, 8).Value  Worksheets("测量记录").Cells(3, 44).Value = Worksheets("TANK TABLE").Cells(26, 8).Value Worksheets("测量记录").Cells(3, 45).Value = Worksheets("TANK TABLE").Cells(29, 4).Value Worksheets("测量记录").Cells(3, 46).Value = Worksheets("TANK TABLE").Cells(30, 4).Value Worksheets("测量记录").Cells(3, 47).Value = Worksheets("TANK TABLE").Cells(29, 8).Value Worksheets("测量记录").Cells(3, 48).Value = Worksheets("TANK TABLE").Cells(30, 8).Value Worksheets("测量记录").Cells(3, 49).Value = Worksheets("TANK TABLE").Cells(29, 10).Value Worksheets("测量记录").Cells(3, 50).Value = Worksheets("TANK TABLE").Cells(30, 10).Value Worksheets("测量记录").Cells(3, 51).Value = Worksheets("TANK TABLE").Cells(29, 12).Value Worksheets("测量记录").Cells(3, 52).Value = Worksheets("TANK TABLE").Cells(30, 12).Value Worksheets("测量记录").Cells(3, 53).Value = Worksheets("TANK TABLE").Cells(9, 12).Value  Worksheets("测量记录").Cells(3, 54).Value = Worksheets("TANK TABLE").Cells(10, 12).Value  Worksheets("测量记录").Cells(3, 55).Value = Worksheets("TANK TABLE").Cells(11, 12).Value  Worksheets("测量记录").Cells(3, 56).Value = Worksheets("TANK TABLE").Cells(12, 12).Value  Worksheets("测量记录").Cells(3, 57).Value = Worksheets("TANK TABLE").Cells(13, 12).Value  Worksheets("测量记录").Cells(3, 58).Value = Worksheets("TANK TABLE").Cells(14, 12).Value  Worksheets("测量记录").Cells(3, 59).Value = Worksheets("TANK TABLE").Cells(15, 12).Value  Worksheets("测量记录").Cells(3, 60).Value = Worksheets("TANK TABLE").Cells(16, 12).Value  Worksheets("测量记录").Cells(3, 61).Value = Worksheets("TANK TABLE").Cells(17, 12).Value  Worksheets("测量记录").Cells(3, 62).Value = Worksheets("TANK TABLE").Cells(18, 12).Value  Worksheets("测量记录").Cells(3, 63).Value = Worksheets("TANK TABLE").Cells(23, 12).Value  Worksheets("测量记录").Cells(3, 64).Value = Worksheets("TANK TABLE").Cells(24, 12).Value  Worksheets("测量记录").Cells(3, 65).Value = Worksheets("TANK TABLE").Cells(25, 12).Value  Worksheets("测量记录").Cells(3, 66).Value = Worksheets("TANK TABLE").Cells(26, 12).Value   ' 运行原有代码     ws.Protect Password:="`111111"  End Sub

TA的精华主题

TA的得分主题

 楼主| 发表于 2024-5-30 21:34 | 显示全部楼层
还有1段
2
Sub 存档()
    Dim ws As Worksheet
    Set ws = Worksheets("TANK TABLE")
    ws.Unprotect Password:="`111111"
     Sheets("测量记录").Select
    Rows("3:3").Select
    Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
   Worksheets("测量记录").Cells(3, 1).Value = Worksheets("TANK TABLE").Cells(2, 11).Value
  Worksheets("测量记录").Cells(3, 2).Value = Worksheets("TANK TABLE").Cells(2, 2).Value
  Worksheets("测量记录").Cells(3, 3).Value = Worksheets("TANK TABLE").Cells(9, 5).Value
  Worksheets("测量记录").Cells(3, 4).Value = Worksheets("TANK TABLE").Cells(10, 5).Value
  Worksheets("测量记录").Cells(3, 5).Value = Worksheets("TANK TABLE").Cells(11, 5).Value
  Worksheets("测量记录").Cells(3, 6).Value = Worksheets("TANK TABLE").Cells(12, 5).Value
  Worksheets("测量记录").Cells(3, 7).Value = Worksheets("TANK TABLE").Cells(13, 5).Value
  Worksheets("测量记录").Cells(3, 8).Value = Worksheets("TANK TABLE").Cells(14, 5).Value
  Worksheets("测量记录").Cells(3, 9).Value = Worksheets("TANK TABLE").Cells(15, 5).Value
  Worksheets("测量记录").Cells(3, 10).Value = Worksheets("TANK TABLE").Cells(16, 6).Value
  Worksheets("测量记录").Cells(3, 11).Value = Worksheets("TANK TABLE").Cells(17, 6).Value
  Worksheets("测量记录").Cells(3, 12).Value = Worksheets("TANK TABLE").Cells(18, 6).Value
  Worksheets("测量记录").Cells(3, 13).Value = Worksheets("TANK TABLE").Cells(23, 5).Value
  Worksheets("测量记录").Cells(3, 14).Value = Worksheets("TANK TABLE").Cells(24, 5).Value
  Worksheets("测量记录").Cells(3, 15).Value = Worksheets("TANK TABLE").Cells(25, 6).Value
Worksheets("测量记录").Cells(3, 16).Value = Worksheets("TANK TABLE").Cells(26, 6).Value
Worksheets("测量记录").Cells(3, 17).Value = Worksheets("TANK TABLE").Cells(9, 7).Value
Worksheets("测量记录").Cells(3, 18).Value = Worksheets("TANK TABLE").Cells(10, 7).Value
Worksheets("测量记录").Cells(3, 19).Value = Worksheets("TANK TABLE").Cells(11, 7).Value
Worksheets("测量记录").Cells(3, 20).Value = Worksheets("TANK TABLE").Cells(12, 7).Value
Worksheets("测量记录").Cells(3, 21).Value = Worksheets("TANK TABLE").Cells(13, 7).Value
Worksheets("测量记录").Cells(3, 22).Value = Worksheets("TANK TABLE").Cells(14, 7).Value
Worksheets("测量记录").Cells(3, 23).Value = Worksheets("TANK TABLE").Cells(15, 7).Value
Worksheets("测量记录").Cells(3, 24).Value = Worksheets("TANK TABLE").Cells(16, 7).Value
Worksheets("测量记录").Cells(3, 25).Value = Worksheets("TANK TABLE").Cells(17, 7).Value
Worksheets("测量记录").Cells(3, 26).Value = Worksheets("TANK TABLE").Cells(18, 7).Value
Worksheets("测量记录").Cells(3, 27).Value = Worksheets("TANK TABLE").Cells(23, 7).Value
Worksheets("测量记录").Cells(3, 28).Value = Worksheets("TANK TABLE").Cells(24, 7).Value
Worksheets("测量记录").Cells(3, 29).Value = Worksheets("TANK TABLE").Cells(25, 7).Value
Worksheets("测量记录").Cells(3, 30).Value = Worksheets("TANK TABLE").Cells(26, 7).Value
Worksheets("测量记录").Cells(3, 31).Value = Worksheets("TANK TABLE").Cells(9, 8).Value
Worksheets("测量记录").Cells(3, 32).Value = Worksheets("TANK TABLE").Cells(10, 8).Value
Worksheets("测量记录").Cells(3, 33).Value = Worksheets("TANK TABLE").Cells(11, 8).Value
Worksheets("测量记录").Cells(3, 34).Value = Worksheets("TANK TABLE").Cells(12, 8).Value
Worksheets("测量记录").Cells(3, 35).Value = Worksheets("TANK TABLE").Cells(13, 8).Value
Worksheets("测量记录").Cells(3, 36).Value = Worksheets("TANK TABLE").Cells(14, 8).Value
Worksheets("测量记录").Cells(3, 37).Value = Worksheets("TANK TABLE").Cells(15, 8).Value
Worksheets("测量记录").Cells(3, 38).Value = Worksheets("TANK TABLE").Cells(16, 8).Value
Worksheets("测量记录").Cells(3, 39).Value = Worksheets("TANK TABLE").Cells(17, 8).Value
Worksheets("测量记录").Cells(3, 40).Value = Worksheets("TANK TABLE").Cells(18, 8).Value
Worksheets("测量记录").Cells(3, 41).Value = Worksheets("TANK TABLE").Cells(23, 8).Value
Worksheets("测量记录").Cells(3, 42).Value = Worksheets("TANK TABLE").Cells(24, 8).Value
Worksheets("测量记录").Cells(3, 43).Value = Worksheets("TANK TABLE").Cells(25, 8).Value
Worksheets("测量记录").Cells(3, 44).Value = Worksheets("TANK TABLE").Cells(26, 8).Value
Worksheets("测量记录").Cells(3, 45).Value = Worksheets("TANK TABLE").Cells(29, 4).Value
Worksheets("测量记录").Cells(3, 46).Value = Worksheets("TANK TABLE").Cells(30, 4).Value
Worksheets("测量记录").Cells(3, 47).Value = Worksheets("TANK TABLE").Cells(29, 8).Value
Worksheets("测量记录").Cells(3, 48).Value = Worksheets("TANK TABLE").Cells(30, 8).Value
Worksheets("测量记录").Cells(3, 49).Value = Worksheets("TANK TABLE").Cells(29, 10).Value
Worksheets("测量记录").Cells(3, 50).Value = Worksheets("TANK TABLE").Cells(30, 10).Value
Worksheets("测量记录").Cells(3, 51).Value = Worksheets("TANK TABLE").Cells(29, 12).Value
Worksheets("测量记录").Cells(3, 52).Value = Worksheets("TANK TABLE").Cells(30, 12).Value
Worksheets("测量记录").Cells(3, 53).Value = Worksheets("TANK TABLE").Cells(9, 12).Value
Worksheets("测量记录").Cells(3, 54).Value = Worksheets("TANK TABLE").Cells(10, 12).Value
Worksheets("测量记录").Cells(3, 55).Value = Worksheets("TANK TABLE").Cells(11, 12).Value
Worksheets("测量记录").Cells(3, 56).Value = Worksheets("TANK TABLE").Cells(12, 12).Value
Worksheets("测量记录").Cells(3, 57).Value = Worksheets("TANK TABLE").Cells(13, 12).Value
Worksheets("测量记录").Cells(3, 58).Value = Worksheets("TANK TABLE").Cells(14, 12).Value
Worksheets("测量记录").Cells(3, 59).Value = Worksheets("TANK TABLE").Cells(15, 12).Value
Worksheets("测量记录").Cells(3, 60).Value = Worksheets("TANK TABLE").Cells(16, 12).Value
Worksheets("测量记录").Cells(3, 61).Value = Worksheets("TANK TABLE").Cells(17, 12).Value
Worksheets("测量记录").Cells(3, 62).Value = Worksheets("TANK TABLE").Cells(18, 12).Value
Worksheets("测量记录").Cells(3, 63).Value = Worksheets("TANK TABLE").Cells(23, 12).Value
Worksheets("测量记录").Cells(3, 64).Value = Worksheets("TANK TABLE").Cells(24, 12).Value
Worksheets("测量记录").Cells(3, 65).Value = Worksheets("TANK TABLE").Cells(25, 12).Value
Worksheets("测量记录").Cells(3, 66).Value = Worksheets("TANK TABLE").Cells(26, 12).Value

' 运行原有代码
    ws.Protect Password:="`111111"

End Sub

TA的精华主题

TA的得分主题

发表于 2024-5-30 21:57 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2024-5-30 22:04 来自手机 | 显示全部楼层
用个with吧,至少能打写点字,没有找到规律,不知道能不能循环

TA的精华主题

TA的得分主题

发表于 2024-5-30 22:13 | 显示全部楼层
应该可以FOR循环,建议上传文件,数据比较保密的话,可以修改一下数据
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-11-17 04:41 , Processed in 0.032664 second(s), 10 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表