|
Dim c As String, r As Long
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
ActiveCell = TextBox1.Text
TextBox1.Visible = False
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Target.Column <> 8 Or Target.Column <> 20 Or Target.Column <> 32 Then TextBox1.Visible = False
If Target.Row < 8 Or Target.Row > 32 Then Exit Sub
c = ""
If Target.Column = 8 Then
c = "H"
ElseIf Target.Column = 20 Then
c = "T"
ElseIf Target.Column = 32 Then
c = "AF"
End If
If Len(c) > 0 Then
Application.EnableEvents = False
Cells(Target.Row, c).Select
With Sheet1.TextBox1
.Top = ActiveCell.Top
.Left = ActiveCell.Left
.Text = ""
.Activate
.Visible = True
End With
Application.EnableEvents = True
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Target.Row < 8 Or Target.Row > 32 Then Exit Sub
c = ""
If Target.Column = 8 Then
n = 8
ElseIf Target.Column = 20 Then
n = 20
ElseIf Target.Column = 32 Then
n = 32
End If
If Target.Column > 7 And Target.Column < 33 And IsNumeric(Target.Value) Then
x = Round(Target(1).Value * 100): y = Len(x)
Cells(Target.Row, n).Resize(, 11) = ""
If x = 0 Then Cells(Target.Row, n).Resize(, 11) = "": Exit Sub
Dim ar(1 To 11)
For i = 1 To y
ar(i) = Mid(x, i, 1)
Next
Cells(Target.Row, n + 10 - y).Resize(, y) = ar
End If
End Sub
|
评分
-
1
查看全部评分
-
|