## 用户名 Email 自动登录 找回密码 密码 注册
 搜索
 数据透视表40+个常用小技巧，让你一次学会！

# [已解决]用VBA判断（交货期是否超了和进度） 发表于 2022-11-28 21:32 | 显示全部楼层 |阅读模式
3学分
 用VBA判断（交货期是否超了和进度） 最佳答案 cutecpu 2022-11-28 21:32 15968725770 发表于 2022-11-30 12:54 谢谢老师 Sub demo()   today = Format(Now, "yymmdd")   m = [m11:m99]   s = [s11:s99]   a = [y11:ac99]   For i = 1 To UBound(a)     If s(i, 1) = "" Then: GoTo 1     n = s(i, 1) - a(i, 5)     a(i, 1) = IIf(m(i, 1) & "" < today, "超期", "沒有超期")     If n > 0 Then       a(i, 2) = IIf(n < s(i, 1), "不夠", "零支")     ElseIf n = 0 Then       a(i, 2) = "完成"     Else       a(i, 2) = "多了" & -n & "支"     End If     a(i, 4) = n 1:   Next   [y11].Resize(i - 1, 5) = a End Sub .best_avatar img{width: 30px;height: 30px;border-radius: 30px;} 11.81 KB, 下载次数: 10

### 最佳答案

Sub demo() today = Format(Now, "yymmdd") m = [m11:m99] s = [s11:s99] a = [y11:ac99] For i = 1 To UBound(a) If s(i, 1) = "" Then: GoTo 1 n = s(i, 1) - a(i, 5) a(i, 1) = IIf(m(i, 1) & "" < today, "超期", "沒有超期") If n > 0 Then a(i, 2) = IIf(n < s(i, 1), "不夠", "零支") ElseIf n = 0 Then a(i, 2) = "完成" Else a(i, 2) = "多了" & -n ... 发表于 2022-11-28 21:32 | 显示全部楼层    本楼为最佳答案 .pct{min-height:100px;} 15968725770 发表于 2022-11-30 12:54 谢谢老师 Sub demo()   today = Format(Now, "yymmdd")   m = [m11:m99]   s = [s11:s99]   a = [y11:ac99]   For i = 1 To UBound(a)     If s(i, 1) = "" Then: GoTo 1     n = s(i, 1) - a(i, 5)     a(i, 1) = IIf(m(i, 1) & "" < today, "超期", "沒有超期")     If n > 0 Then       a(i, 2) = IIf(n < s(i, 1), "不夠", "零支")     ElseIf n = 0 Then       a(i, 2) = "完成"     Else       a(i, 2) = "多了" & -n & "支"     End If     a(i, 4) = n 1:   Next   [y11].Resize(i - 1, 5) = a End Sub 发表于 2022-11-29 08:55 | 显示全部楼层
 Sub demo()   today = Format(Now, "yymmdd")   m = [m11:m18]   s = [s11:s18]   a = [y11:ac18]   For i = 1 To UBound(a)     n = s(i, 1) - a(i, 5)     a(i, 1) = IIf(m(i, 1) & "" < today, "超期", "沒有超期")     If n > 0 Then       a(i, 2) = IIf(n < s(i, 1), "不夠", "零支")     ElseIf n = 0 Then       a(i, 2) = "完成"     Else       a(i, 2) = "多了" & -n & "支"     End If     a(i, 4) = n   Next   [y11].Resize(i - 1, 5) = a End Sub 楼主| 发表于 2022-11-30 12:03 | 显示全部楼层
 cutecpu 发表于 2022-11-29 08:55 Sub demo()   today = Format(Now, "yymmdd")   m = [m11:m18] 谢谢老师改下 合同支数是空的，后面判断为空 发表于 2022-11-30 12:08 | 显示全部楼层
 15968725770 发表于 2022-11-30 12:03 谢谢老师改下 合同支数是空的，后面判断为空 超出交货日期、进度、未完成支数 三個欄位都 留空白嗎 楼主| 发表于 2022-11-30 12:54 | 显示全部楼层
 本帖最后由 15968725770 于 2022-11-30 12:57 编辑 http://www.excelpx.com/forum.php?mod=attachment&aid=NDU2MDIzfDBmYzJkNjUzN2JjYTdjMjEyN2Y2ZDJiOGIzZTY5NWQ2fDE2NzU1OTEyNDc%3D&request=yes&_f=.rarcutecpu 发表于 2022-11-30 12:08 超出交货日期、进度、未完成支数 三個欄位都 留空白嗎 谢谢老师 50 KB, 下载次数: 2

 本版积分规则 回帖后跳转到最后一页

GMT+8, 2023-2-5 18:00 , Processed in 0.393033 second(s), 8 queries , Gzip On, Yac On.