+ -
当前位置:首页 → 问答吧 → 请高手进改代码~~~~~~~~~

请高手进改代码~~~~~~~~~

时间:2011-08-09

来源:互联网

求助:以下代码问题出在哪儿?运行提示类型不匹配,求指正
Private Sub CommandButton1_Click()
Dim aa, bb, cc, dd, dx, HT As String
Sheets("核对表").Select
        i = 7
    Do While Not (IsEmpty(Sheets("核对表").Cells(i, 2).Value))
       i = i + 1
       Loop
       i = i - 1
      
Sheets("核对表").Select
    For d = 7 To 180
    Sheets("核对表").Cells(d, 5).Value = 0
    Next d
        

Sheets("pos机明细").Select
        j = 3
    Do While Not (IsEmpty(Sheets("pos机明细").Cells(j, 1).Value))
       j = j + 1
       Loop
       j = j - 1
      
      
      Sheets("核对表").Select
      m = j
       Do While m > 3
       n = 7
       ee = Sheets("核对表").Cells(m, 16).Value
       If ee >= 16.3 Then
            Do While n <= i
                 aa = Sheets("核对表").Cells(n, 3).Value
                 bb = Sheets("核对表").Cells(m, 15).Value
                 cc = Sheets("核对表").Cells(n, 14).Value
                 dd = Sheets("核对表").Cells(n, 5).Value
                 If aa = bb Then
                  If cc > dd Then
                  dz = Sheets("核对表").Cells(n, 5).Value
                  HT = Sheets("核对表").Cells(m, 13).Value
                  Sheets("核对表").Cells(n, 5).Value = dz + HT
                  End If
                  End If
             n = n + 1
            Loop
        End If
        m = m - 1
        Loop
   
End Sub

作者: liyu10   发布时间: 2011-08-09

语法好似没问题,但好烂。没附件不好说。

作者: Zamyi   发布时间: 2011-08-09

能帮忙改进下么。。。。

作者: liyu10   发布时间: 2011-08-09

请帮忙看看,附件

附件

龙岩POS机核对表.rar(102.96 KB)

2011-8-9 11:38, 下载次数: 10

作者: liyu10   发布时间: 2011-08-09

把Do While Not (IsEmpty(Sheets("pos机明细").Cells(j, 1).Value))
       j = j + 1
       Loop
       j = j - 1
下面的j=j-1
改为:
j=j-2  即可。

作者: 蓝桥玄霜   发布时间: 2011-08-09