Sub hello()
Dim Z As Integer
Dim X As Integer
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim D As Integer
Dim E As Integer
Dim G As Integer
Dim H As Integer
Dim I As Integer
Dim J As Integer
Dim K As Integer
Dim W As Integer
Dim Y As Integer
Dim M As Integer
Dim Q As Integer
Dim L As Integer
Dim Z1 As Integer
Dim Z2 As Integer
Dim Z3 As Integer
Dim G1 As Integer
Dim G2 As Integer
Dim G3 As Integer
Dim G4 As Integer
Dim G5 As Integer
Dim G6 As Integer
Dim Z4 As Integer
Dim E1 As Integer
Dim E2 As Integer
Dim E3 As Integer
Dim E4 As Integer
Dim E5 As Integer
Dim E6 As Integer
Dim E7 As Integer
Dim E8 As Integer
Dim E9 As Integer
Dim E10 As Integer
For G2 = 7 To 17
Cells("2", "CS") = 0
Cells("2", "CT") = 0
Cells("2", "CU") = 0
Cells("2", "CV") = 0
Cells("2", "CW") = 0
Cells("2", "CX") = 0
Cells("2", "CY") = 0
Cells("2", "CZ") = 0
Cells("2", "DA") = 0
Cells("2", "DB") = 0
If G2 = 7 ThenZ3 = Cells("3", "DC").ValueZ2 = G2End If
If G2 = 8 ThenZ3 = Cells("3", "DD").ValueZ2 = G2End If
If G2 = 9 ThenZ3 = Cells("3", "DE").ValueZ2 = G2End If
If G2 = 10 ThenZ3 = Cells("3", "DF").ValueZ2 = G2End If
If G2 = 11 ThenZ3 = Cells("3", "DG").ValueZ2 = G2End If
If G2 = 12 ThenZ3 = Cells("3", "DH").ValueZ2 = G2End If
If G2 = 13 ThenZ3 = Cells("3", "DI").ValueZ2 = G2End If
If G2 = 14 ThenZ3 = Cells("3", "DJ").ValueZ2 = G2End If
If G2 = 15 ThenZ3 = Cells("3", "DK").ValueZ2 = G2End If
If G2 = 16 ThenZ3 = Cells("3", "DL").ValueZ2 = G2End If
If G2 = 17 ThenZ3 = Cells("3", "DM").ValueZ2 = G2End If
For E = Z3 To Range("A65536").End(xlUp).Row
Debug.Print EIf Cells(E, "CS") > 0 Then 程序到这句出错 错误1004 。前面加debug.print E 还是不行。E的值等于0,怎么改?? Cells(E, "CS") = 0
Dim Z As Integer
Dim X As Integer
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim D As Integer
Dim E As Integer
Dim G As Integer
Dim H As Integer
Dim I As Integer
Dim J As Integer
Dim K As Integer
Dim W As Integer
Dim Y As Integer
Dim M As Integer
Dim Q As Integer
Dim L As Integer
Dim Z1 As Integer
Dim Z2 As Integer
Dim Z3 As Integer
Dim G1 As Integer
Dim G2 As Integer
Dim G3 As Integer
Dim G4 As Integer
Dim G5 As Integer
Dim G6 As Integer
Dim Z4 As Integer
Dim E1 As Integer
Dim E2 As Integer
Dim E3 As Integer
Dim E4 As Integer
Dim E5 As Integer
Dim E6 As Integer
Dim E7 As Integer
Dim E8 As Integer
Dim E9 As Integer
Dim E10 As Integer
For G2 = 7 To 17
Cells("2", "CS") = 0
Cells("2", "CT") = 0
Cells("2", "CU") = 0
Cells("2", "CV") = 0
Cells("2", "CW") = 0
Cells("2", "CX") = 0
Cells("2", "CY") = 0
Cells("2", "CZ") = 0
Cells("2", "DA") = 0
Cells("2", "DB") = 0
If G2 = 7 ThenZ3 = Cells("3", "DC").ValueZ2 = G2End If
If G2 = 8 ThenZ3 = Cells("3", "DD").ValueZ2 = G2End If
If G2 = 9 ThenZ3 = Cells("3", "DE").ValueZ2 = G2End If
If G2 = 10 ThenZ3 = Cells("3", "DF").ValueZ2 = G2End If
If G2 = 11 ThenZ3 = Cells("3", "DG").ValueZ2 = G2End If
If G2 = 12 ThenZ3 = Cells("3", "DH").ValueZ2 = G2End If
If G2 = 13 ThenZ3 = Cells("3", "DI").ValueZ2 = G2End If
If G2 = 14 ThenZ3 = Cells("3", "DJ").ValueZ2 = G2End If
If G2 = 15 ThenZ3 = Cells("3", "DK").ValueZ2 = G2End If
If G2 = 16 ThenZ3 = Cells("3", "DL").ValueZ2 = G2End If
If G2 = 17 ThenZ3 = Cells("3", "DM").ValueZ2 = G2End If
For E = Z3 To Range("A65536").End(xlUp).Row
Debug.Print EIf Cells(E, "CS") > 0 Then 程序到这句出错 错误1004 。前面加debug.print E 还是不行。E的值等于0,怎么改?? Cells(E, "CS") = 0
解决方案 »
- 如何编写计算程序运行等待时间的程序,或者有什么控件吗
- VB代码换行
- 用DirectShow播放流媒体,如何判断流媒体的连接以断开!
- mshflexgrid问题
- 請教有關hook的問題.
- 请问有没有可以替代Listview的控件?
- 数据环境(DataEnvironment)中资料来源要用存储过程,而存储过程的参数是通过一窗体动态的获得,请问参数该如何传递?
- 难,开始菜单程序列表的问题
- 如何跳过密码验证读取ACCESS中的SQL链接表
- 求助,API 高手请
- VB6.0使用ADO创建数据库,中文字段排序出现问题
- bIsConnected = axCZKEM1.Connect_Net("192.168.1.253", 4370);
Z3等于0,是因为在你的“For G2 = 7 To 17”中,前面的赋值语句把Z3赋值为0。
它报错时,点“调试”,然后看看G2的值是多少、再找对应的Z3赋值语句,它取的是哪个单元格的值;
再到“当前活动工作表”中,看看对应的单元格是不是没有数据,或值为0。你要注意,你的Z3赋值语句:Z3 = Cells(XX, XXXX).Value
这都没有“明确指定工作表”,那么它就是读取的“当前工作簿的当前活动工作表”,
你在工作簿“选定的工作表”不正确,都会造成执行的错误。这样的VBA代码,写得太差劲了!