Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 2264|回复: 2

[已解决]代码数值的关联性VBA代码

[复制链接]
发表于 2017-9-11 18:29 | 显示全部楼层 |阅读模式
本帖最后由 网络人 于 2017-9-13 09:23 编辑

Private Sub TextBox3_Change()
If e = False Then TextBox8.Value = "1.2"
End If
End Sub

Private Sub TextBox4_Change()
If b = False Then TextBox8.Value = "1.2"
End If
End Sub

Private Sub TextBox5_Change()
If c = False And TextBox5 = "400" Then
        TextBox8.Value = "1.15"
        Else
        TextBox8.Value = "1.2"
End If
End Sub
求助Private Sub TextBox5_Change()在运行时如果发现 TextBox8.Value = "1.2"的值就等1.2,否则就执行下面的代码
If c = False And TextBox5 = "400" Then
        TextBox8.Value = "1.15"
        Else
        TextBox8.Value = "1.2"
End If
End Sub的VBA代码求助

最佳答案
2017-9-12 12:51
  1. Private Sub TextBox5_Change()
  2. If textbox8.Value = "1.2" Then
  3.   textbox5 = "1.2"
  4. Else
  5.   If c = False And textbox5 = "400" Then
  6.     textbox8.Value = "1.15"
  7.   Else
  8.     textbox8.Value = "1.2"
  9.   End If
  10. End If
  11. End Sub
复制代码
 楼主| 发表于 2017-9-12 09:03 | 显示全部楼层
回复

使用道具 举报

发表于 2017-9-12 12:51 | 显示全部楼层    本楼为最佳答案   
  1. Private Sub TextBox5_Change()
  2. If textbox8.Value = "1.2" Then
  3.   textbox5 = "1.2"
  4. Else
  5.   If c = False And textbox5 = "400" Then
  6.     textbox8.Value = "1.15"
  7.   Else
  8.     textbox8.Value = "1.2"
  9.   End If
  10. End If
  11. End Sub
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-4-27 03:59 , Processed in 0.295634 second(s), 7 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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