楼主 liu12345678jing |
上次在网上看到有人问了一个问题,说是当a1=1时,a2,a3的值为0;当a2=1时,a1,a3的值为0;当a3=1时,a1,a2的值为0;这个代码我终会写了,现在和大家分享一下: Sub test() If Cells(1, 1) = 1 And Cells(2, 1) = 0 Then Call a End If If Cells(1, 1) = 1 And Cells(2, 1) = 1 Then Call b End If If Cells(2, 1) = 1 And Cells(3, 1) = 1 Then Call c End If End Sub Sub a() Cells(1, 1) = 1 Cells(2, 1) = 0 Cells(3, 1) = 0 End Sub Sub b() Cells(1, 1) = 0 Cells(2, 1) = 1 Cells(3, 1) = 0 End Sub Sub c() Cells(1, 1) = 0 Cells(2, 1) = 0 Cells(3, 1) = 1 End Sub |
2楼 老糊涂 |
a、b、c的过程代码呢? |
3楼 liu12345678jing |
sub a() cells(1,1)=1 cells(2,1)=0 cells(3,1)=0 sub b() cells(1,1)=0 cells(2,1)=1 cells(3,1)=0 sub c(0 cells(1,1)=0 cells(2,1)=0 cells(3,1)=1 |
4楼 omnw |
帮助楼主整理一下代码:
|
5楼 liu12345678jing |
谢谢!我写的太草了。 |