|
本帖最后由 eking_tang 于 2015-6-17 10:04 编辑
我目前用的代码其中一段如下:
ans = MsgBox("计算时间", 36)
If ans <> 6 Then Exit Sub
n = Range("A6").Value
For d = rwMoStart To Cells(rwHideBottomRow, clBottomRow) - 1
If Cells(d, clMoNo) <> "" Then
Cells(d, clSeq) = n
End If
代码运算前,还需要人为去手输"A6"的值,
其实这个值是可以通过其他单元格的内容来自动计算的.所以想请大神帮忙对代码做一下修改.
增加一个条件判定:
如果储存格"B1"里边,包含汉字"精英培训",则n = TimeValue("08:10:00"),否则n = TimeValue("20:10:00")
感谢
ans = MsgBox("计算时间", 36)
If ans <> 6 Then Exit Sub
'n = Range("A6").Value
n = IIf(InStr([b6], "精英培训"), TimeValue("08:10:00"), TimeValue("20:10:00"))
For d = rwMoStart To Cells(rwHideBottomRow, clBottomRow) - 1
If Cells(d, clMoNo) <> "" Then
Cells(d, clSeq) = n
End If
Next d
建议指定是哪个工作表中的B6?
比如,是第一张工作表的,就改成 sheets(1).[b6]
|
|