我寫的程式如下
=========================
Private Sub CommandButton1_Click()
Call test
End Sub
Sub test()
Dim A As Range
If Application.CountBlank(Sheet1.Range("A1:A99")) = 0 Then
Sheet1.[A100] = ComboBox1.Value
Else
Set A = [A3]
Do Until A = ""
Set A = A.Offset(1, 0)
Loop
A.Value = ComboBox1.Value
End If
If ComboBox1.ListIndex = -1 Then MsgBox "空白未填寫 !!": Exit Sub
a1 = UserForm.TextBox1.Value
If Application.CountBlank([B1:B99]) = 0 Then Range("B100") = a1: Exit Sub
For Each A In [B3:B99]
If A = "" Then
A.Value = a1
Exit For
End If
Next
If .a1 = "" Then MsgBox "空白未填寫 !!": Exit Sub
a2 = UserForm.TextBox2.Value
If Application.CountBlank([C1:C99]) = 0 Then Range("C100") = a2: Exit Sub
For Each A In [C1:C99]
If A = "" Then
A.Value = a2
Exit For
End If
Next
If .a2= "" Then MsgBox "空白未填寫 !!": Exit Sub
End Sub作者: mark15jill 時間: 2013-3-11 16:37