Calender

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  
<< October 2019 >>

Categories

Archives

Recent Entries

中学生のためのExcel VBA

3-14 郵便番号と住所(4)エラー回避

JUGEMテーマ:Office VBA

 

Private Sub TextBox1_AfterUpdate()
Call hani
    Cells(gyou + 1, "s").Value = TextBox1.Text
Cells(gyou + 1, "s").NumberFormatLocal = "000-0000"
Range("t4:x4").Copy
Cells(gyou + 1, "t").PasteSpecial (xlPasteFormulas)
Application.CutCopyMode = False
If IsError(Cells(gyou + 1, "x").Value) Then
    MsgBox "郵便番号が違います。" 
 ' TextBox2.Text = ""
With TextBox1
            .SetFocus
            .SelStart = 0
            .SelLength = Len(.Text)
        End With
 ' TextBox1.SetFocus
 Else
Cells(gyou + 1, "w").Value = ""
TextBox2.Text = Cells(gyou + 1, "x").Value
 End If
End Sab
 

  • 2019.05.25 Saturday
  • 15:26

Comment
Send Comment