- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
8#
發表於 2015-11-16 11:28
| 只看該作者
回復 6# v03586
試試看- Option Explicit
- Private Sub CommandButton1_Click()
- Dim Rng As Range, Ar(1 To 2), i As Integer
- Ar(1) = Array(OptionButton1, OptionButton2, OptionButton3) ', OptionButton4, OptionButton5, OptionButton6....
- Ar(2) = Array(TextBox1, TextBox2, TextBox3, TextBox4, TextBox5) ', TextBox6, TextBox7, TextBox8, TextBox9....
-
- 'Join 函數 傳回一個字串,該字串是透過連結某個(一維)陣列中的多個子字串而建立的。
- If InStr(UCase(Join(Ar(1), "")), "TRUE") = 0 Or InStr(Join(Ar(2), ","), ",,") Then
- MsgBox ("資料未輸入完整, 『 * 』 必須輸入" & vbCrLf & _
- "Data is not enter the full , 『 * 』 you must fill ")
- Exit Sub
- End If
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Set Rng = Sheets("FMC Input Database").Range("a" & Rows.Count).End(xlUp).Offset(1)
- With Rng '物件Rng : 所指定的儲存格或儲存格範圍。(不必移動工作頁)
- For i = 0 To UBound(Ar(1))
- If Ar(1)(i).Value Then
- 'Caption 屬性 出現在物件上的修飾文字 , 一般用來辨識或描述該物件
- .Value = Ar(1)(i).Caption
- Exit For
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- End If
- Next
- '.Range("B1")->這Rng 的 儲存格或儲存格範圍。
- .Range("B1").Resize(, UBound(Ar(2)) + 1) = Ar(2)
- .Range("G1") = Now
- ''''''''''''''''''''''''''''''''''''''''''''
- End With
- End Sub
複製代碼 |
|