各位請問 這是一個產品資料搜尋的EXCEL檔假設EXCEL做了4個文字方塊 產品編號 廠商 數量 交期 當我在產品編號輸入了一組編號 會自動搜尋到對應的產品編號並輸入的值會自動帶入下列三個TextBox內(廠商 數量 交期) 這些值會自動帶入相對應的表格內這該用哪個語法表示呢?

2015-10-05 4:25 am

回答 (2)

2015-10-05 4:50 am
可以用VLOOKUP函數來做設定 以產品編號自動帶出已建基本資料的產品詳細內容
參考: http://oliverkong358.blogspot.tw/2013/09/blog-post_1028.html 簡單、好用的進銷存系統:相同的資料完全不必重複輸入 都會自動帶出產生
2015-10-05 11:44 am
1.UserForm1改變定位順序TextBox1..CommandButton1..CommandButton2

2.
Private Sub CommandButton1_Click()
Dim Sc As Variant
Dim Tx As Integer
If TextBox1 > "" Then
Tx = Val(TextBox1)
Set Sx = Sheets(1).[A:A]
Sc = Application.Match(Tx, Sx, 0)
If Not IsError(Sc) Then
TextBox2 = Cells(Sc, 2)
TextBox3 = Cells(Sc, 3)
TextBox4 = Cells(Sc, 4)
Else
TextBox1 = "輸入錯誤"
TextBox1.SetFocus
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1)
Exit Sub

End If
End If
TextBox1.SetFocus
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1)
End Sub


複製到其他位置
Sht = Sheets(2).[A65536].End(xlUp).Row + 1
Rows(Sc).Copy Sheets(2).Cells(Sht, 1)

Cells(Sc, 1).Resize(1, 4).Copy Sheets(2).Cells(1, 1)


收錄日期: 2021-05-04 02:00:39
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20151004202532AAyS0Po

檢視 Wayback Machine 備份