標題:
[發問]
Checkbox帶入儲存格為簡碼
[打印本頁]
作者:
lifedidi
時間:
2013-5-17 16:00
標題:
Checkbox帶入儲存格為簡碼
大大好:
最近遇到需要勾選的表單,製做上遇到了困難,
1.如何帶入工作表
2.帶入工作表為簡碼
簡單的範本請參考附件,謝謝。
[attach]14999[/attach]
作者:
kimbal
時間:
2013-5-17 22:36
回復
1#
lifedidi
單選的情況用OPTIONBUTTON會比較好.
[attach]15007[/attach]
Private Sub CommandButton1_Click()
Call subCall(TextBox1, TextBox2, TextBox3, 1, 7, "一")
Call subCall(TextBox4, TextBox5, TextBox6, 11, 17, "二")
Call subCall(TextBox7, TextBox8, TextBox9, 21, 27, "三")
End Sub
Sub subCall(TB1 As msforms.TextBox, TB2 As msforms.TextBox, TB3 As msforms.TextBox, CBFROM1 As Integer, CBFROM2 As Integer, Rec As String)
Dim strCode, i
If TB1.Value = "" Then
MsgBox "無資料"
Else
Set A = Sheet1.[a65536].End(xlUp).Offset(1, 0)
strCode = ""
For i = CBFROM1 To CBFROM2
With Me.Controls("Opt" & Trim(Str(i)))
If .Value Then
strCode = Application.WorksheetFunction.VLookup(.Caption, Sheet2.Range("A1:B8"), 2, False)
End If
End With
Next
A.Resize(, 4).Value = Array(TB1, TB2, TB3, strCode)
MsgBox "第" & Rec & "筆資料建立成功!", vbOKOnly, "成功"
End If
End Sub
複製代碼
作者:
lifedidi
時間:
2013-5-20 10:06
太棒了!謝謝版主kimbal大大!
一次就解決問題!謝謝!
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)