- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
        
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2010-10-18 09:01 ½s¿è
¦^´_ 1# dechiuan999
°ÝÃD¦bPrivate Sub CommandButton5_Click()
With Range("û¤u°ò¥»¸ê®Æ")
mStr1a = TextBox1.Text
Set mRng1b = Range("û¤u°ò¥»¸ê®Æ").Columns(1).Find(what:=mStr1a, lookat:=xlWhole, searchorder:=xlByRows)
If Not mRng1b Is Nothing Then
MsgBox "§A¿é¤Jªºû¤u½s¸¹«ÂÐ" & vbCrLf & vbCrLf & "½Ð«·s¿é¤Jû¤u½s¸¹"
Exit Sub
End If
mRow1 = Range("û¤u°ò¥»¸ê®Æ").Rows.Count 'pºâ¥X©w¸q¦WºÙªº¦C¼Æ
If TypeName(Selection) = "Range" Then
.Cells(1).End(xlDown).Offset(1).Select '½Ð¥[¤J³o¤@¬q
If Intersect(Selection, Range("û¤u°ò¥»¸ê®Æ").End(xlDown).Offset(1)) Is Nothing Then
'MsgBox "½Ð¥ý¿ï¨ú¿é¤J¸ê®Æ«ü©w¦ì¸m"
Exit Sub
Else
''''''''''''''''''''''''''''''''''''''''''''''''''''''
CommandButton5_Click() ·s¼W¸ê®Æªº¨¾§b±¹¬I ¤Ö¤F©m¦Wªº¨¾§b
¨¾§b¤§«á ·s¼W¸ê®Æª½±µ¥Î ¤£¥Î²z·|selectionªº¨Æ ¦p¤U- Private Sub CommandButton5_Click()
- Dim Sh As Worksheet, Rng As Range
- Set Sh = Worksheets("û¤u°ò¥»¸ê®Æ")
- Set Rng = Sh.Range("A" & Rows.Count).End(xlUp).Offset(1)
- With TextBox1
- If Application.CountIf(Sh.Columns(1), .Text) > 0 Then
- MsgBox "§A¿é¤Jªºû¤u½s¸¹«ÂÐ" & vbCrLf & vbCrLf & "½Ð«·s¿é¤Jû¤u½s¸¹"
- Exit Sub
- ElseIf Len(.Text) = 5 Then
- If IsNumeric(.Text) Then Rng.Cells(1, 1).NumberFormatLocal = "@"
- Else
- MsgBox "û¤u½s¸¹¬°¤Ó¦r¤¸"
- Exit Sub
- End If
- End With
- With TextBox2
- If Application.CountIf(Sh.Columns(2), .Text) > 0 Then
- MsgBox "§A¿é¤Jªº ©m¦W «ÂÐ" & vbCrLf & vbCrLf & "½Ð«·s¿é¤Jû¤u ©m¦W"
- Exit Sub
- ElseIf Len(.Text) = 0 Then
- MsgBox "§A¨S¦³ ¿é¤J©m¦W " & vbCrLf & vbCrLf & "½Ð«·s¿é¤Jû¤u ©m¦W"
- End If
- End With
- With TextBox3 '¨¥÷ÃÒ¦t¤¸¬° 10 Ó¦t¤¸
- If Application.CountIf(Sh.Columns(3), .Text) > 0 Then
- MsgBox "¨¥÷ÃÒ¦t¸¹ «½Æ" & vbCrLf & vbCrLf & "½Ð«·s¿é¤J ¨¥÷ÃÒ¦t¸¹ "
- Exit Sub
- ElseIf Len(.Text) = 10 Then
- If Not IsNumeric(.Text) Then Rng.Cells(1, 3).NumberFormatLocal = "@"
- Else
- MsgBox "¨¥÷ÃÒ¦t¤¸¬° 10 Ó¦t¤¸"
- Exit Sub
- End If
- End With
- With TextBox5 ''¥ß±b§½¸¹¤¸¬° 7 Ó¦t¤¸
- If Len(.Text) = 7 Then
- If IsNumeric(.Text) Then Range("û¤u°ò¥»¸ê®Æ").Cells(mRow1a, 5).NumberFormatLocal = "@"
- Else
- MsgBox "¥ß±b§½¸¹¤¸¬° 7 Ó¦t¤¸"
- Exit Sub
- End If
- End With
- With TextBox6 '¦sï±b¸¹¦r¤¸¬° 7 Ó¦t¤¸
- If Len(.Text) = 7 Then
- If IsNumeric(.Text) Then Range("û¤u°ò¥»¸ê®Æ").Cells(mRow1a, 6).NumberFormatLocal = "@"
- Else
- MsgBox "¦sï±b¸¹¦r¤¸¬° 7 Ó¦t¤¸"
- Exit Sub
- End If
- End With
- With Rng
- .Cells(1, 1) = TextBox1.Value
- .Cells(1, 2) = TextBox2.Value
- .Cells(1, 3) = TextBox3.Value
- .Cells(1, 4) = TextBox4.Value
- .Cells(1, 5) = TextBox5.Value
- .Cells(1, 6) = TextBox6.Value
- .Cells(1, 7) = TextBox7.Value
- .Cells(1, 9) = TextBox8.Value
- If OptionButton1.Value = True Then
- .Cells(1, 8) = "¦b¾"
- ElseIf OptionButton2.Value = True Then
- .Cells(mRow1a, 8) = "Â÷¾"
- End If
- End With
- MsgBox "¸ê®Æ·s¼W §¹²¦"
- Set Sh = Nothing
- Set Rng = Nothing
- End Sub
½Æ»s¥N½X |
|