- ©«¤l
- 559
- ¥DÃD
- 58
- ºëµØ
- 0
- ¿n¤À
- 626
- ÂI¦W
- 0
- §@·~¨t²Î
- win8
- ³nÅ骩¥»
- office2013
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- TW
- µù¥U®É¶¡
- 2010-11-22
- ³Ì«áµn¿ý
- 2024-6-14
|
¥»©«³Ì«á¥Ñ hugh0620 ©ó 2011-4-8 18:26 ½s¿è
¦^´_ 1# a703130
¼Ó¥Dnªº¬O¤£¬O¦p¤U¹Ïªºµ²ªG©O???
¦Û¦æ±a¥X¬On«ö¶s¦¡??©Î¬O¿é¤J§¹´N¦Û¦æ±a¥X??
»Ý¨D¤£¤@¼Ë~ ¼gªk´N¤£¤@¼Ëò??
¥ý¼g¤@Ó¿é¤J§¹´N¦Û¦æ±a¥X
¨Ì±z³]©wªºcells(4,10)ªº¦ì¸m¼¶¼g
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
Select Case Target.Column
Case 10
If Target = "" Or Target.Offset(0, 1) = "" Or Target.Offset(0, 2) = "" Then Exit Sub
If Target = "U2" Then 'U2=0 ~ 65535
If Target.Offset(0, 1) >= 0 And Target.Offset(0, 1) <= 65536 Then '§PÂ_³Ì¤pÈ
Min1 = Target.Offset(0, 1)
Else
Min1 = 0
End If
If Target.Offset(0, 2) >= 0 And Target.Offset(0, 2) <= 65536 Then '§PÂ_³Ì¤jÈ
Max1 = Target.Offset(0, 2)
Else
Max1 = 65535
End If
Target.Offset(0, 5) = "0 ~ 65535"
ElseIf Target = "U1" Then 'U1=0 ~ 255
If Target.Offset(0, 1) >= 0 And Target.Offset(0, 1) <= 255 Then '§PÂ_³Ì¤pÈ
Min1 = Target.Offset(0, 1)
Else
Min1 = 0
End If
If Target.Offset(0, 2) >= 0 And Target.Offset(0, 2) <= 255 Then '§PÂ_³Ì¤jÈ
Max1 = Target.Offset(0, 2)
Else
Max1 = 255
End If
Target.Offset(0, 5) = "0 ~ 255"
ElseIf Target = "S1" Then 'S1=-127 ~ +127
If Target.Offset(0, 1) >= -127 And Target.Offset(0, 1) <= 127 Then '§PÂ_³Ì¤pÈ
Min1 = Target.Offset(0, 1)
Else
Min1 = -127
End If
If Target.Offset(0, 2) >= -127 And Target.Offset(0, 2) <= 127 Then '§PÂ_³Ì¤jÈ
Max1 = Target.Offset(0, 2)
Else
Max1 = 127
End If
Target.Offset(0, 5) = "-127 ~ +127"
Else 'S2=-32767 ~ +32767
If Target.Offset(0, 1) >= -32767 And Target.Offset(0, 1) <= 32767 Then '§PÂ_³Ì¤pÈ
Min1 = Target.Offset(0, 1)
Else
Min1 = -32767
End If
If Target.Offset(0, 2) >= -32767 And Target.Offset(0, 2) <= 32767 Then '§PÂ_³Ì¤jÈ
Max1 = Target.Offset(0, 2)
Else
Max1 = 32767
End If
Target.Offset(0, 5) = "'-32767 ~ +32767"
End If
Target.Offset(0, 3) = Min1 & "~" & Max1
Case 11
If Target = "" Or Target.Offset(0, -1) = "" Or Target.Offset(0, 1) = "" Then Exit Sub
If Target.Offset(0, -1) = "U2" Then 'U2=0 ~ 65535
If Target >= 0 And Target <= 65535 Then '§PÂ_³Ì¤pÈ
Min1 = Target
Else
Min1 = 0
End If
If Target.Offset(0, 1) >= 0 And Target.Offset(0, 1) <= 65535 Then '§PÂ_³Ì¤jÈ
Max1 = Target.Offset(0, 1)
Else
Max1 = 65535
End If
Target.Offset(0, 4) = "0 ~ 65535"
ElseIf Target.Offset(0, -1) = "U1" Then 'U1=0 ~ 255
If Target >= 0 And Target <= 255 Then '§PÂ_³Ì¤pÈ
Min1 = Target
Else
Min1 = 0
End If
If Target.Offset(0, 1) >= 0 And Target.Offset(0, 1) <= 255 Then '§PÂ_³Ì¤jÈ
Max1 = Target.Offset(0, 1)
Else
Max1 = 255
End If
Target.Offset(0, 4) = "0 ~ 255"
ElseIf Target.Offset(0, -1) = "S1" Then 'S1=-127 ~ +127
If Target >= -127 And Target <= 127 Then '§PÂ_³Ì¤pÈ
Min1 = Target
Else
Min1 = -127
End If
If Target.Offset(0, 1) >= -127 And Target.Offset(0, 1) <= 127 Then '§PÂ_³Ì¤jÈ
Max1 = Target.Offset(0, 1)
Else
Max1 = 127
End If
Target.Offset(0, 4) = "-127 ~ +127"
Else 'S2=-32767 ~ +32767
If Target >= -32767 And Target <= 32767 Then '§PÂ_³Ì¤pÈ
Min1 = Target
Else
Min1 = -32767
End If
If Target.Offset(0, 1) >= -32767 And Target.Offset(0, 1) <= 32767 Then '§PÂ_³Ì¤jÈ
Max1 = Target.Offset(0, 1)
Else
Max1 = 32767
End If
Target.Offset(0, 4) = "-32767 ~ +32767"
End If
Target.Offset(0, 2) = Min1 & "~" & Max1
Case 12
If Target = "" Or Target.Offset(0, -1) = "" Or Target.Offset(0, -2) = "" Then Exit Sub
If Target.Offset(0, -2) = "U2" Then 'U2=0 ~ 65535
If Target.Offset(0, -1) >= 0 And Target.Offset(0, -1) <= 65535 Then '§PÂ_³Ì¤pÈ
Min1 = Target.Offset(0, -1)
Else
Min1 = 0
End If
If Target >= 0 And Target <= 65535 Then '§PÂ_³Ì¤jÈ
Max1 = Target
Else
Max1 = 65535
End If
Target.Offset(0, 3) = "0 ~ 65535"
ElseIf Target.Offset(0, -2) = "U1" Then 'U1=0 ~ 255
If Target.Offset(0, -1) >= 0 And Target.Offset(0, -1) <= 255 Then '§PÂ_³Ì¤pÈ
Min1 = Target.Offset(0, -1)
Else
Min1 = 0
End If
If Target >= 0 And Target <= 255 Then '§PÂ_³Ì¤jÈ
Max1 = Target
Else
Max1 = 255
End If
Target.Offset(0, 3) = "0 ~ 255"
ElseIf Target.Offset(0, -2) = "S1" Then 'S1=-127 ~ +127
If Target.Offset(0, -1) >= -127 And Target.Offset(0, -1) <= 127 Then '§PÂ_³Ì¤pÈ
Min1 = Target.Offset(0, -1)
Else
Min1 = -127
End If
If Target >= -127 And Target <= 127 Then '§PÂ_³Ì¤jÈ
Max1 = Target
Else
Max1 = 127
End If
Target.Offset(0, 3) = "-127 ~ +127"
Else 'S2=-32767 ~ +32767
If Target.Offset(0, -1) >= -32767 And Target.Offset(0, -1) <= 32767 Then '§PÂ_³Ì¤pÈ
Min1 = Target.Offset(0, -1)
Else
Min1 = -32767
End If
If Target >= -32767 And Target <= 32767 Then '§PÂ_³Ì¤jÈ
Max1 = Target
Else
Max1 = 32767
End If
Target.Offset(0, 3) = "-32767 ~ +32767"
End If
Target.Offset(0, 1) = Min1 & "~" & Max1
End Select
End Sub |
|