0
Vlookup
でユーザーフォームを作成したいと思います。情報は別のブックに格納されます。次のVBAコードを使用して、別のExcelブックから必要な情報をテキストフィールドに抽出するにはどうすればよいですか?vlookup別のExcelブックの情報を抽出する
Private Sub Textan_AfterUpdate()
'check to see if value exists
If WorksheetFunction.CountIf(C:\Users\poury\Desktop\ADDON Order Tool\AL010.xlsx.Sheet2.Range("B:B"), Me.Textan.Value) = 0 Then
MsgBox "This is an incorrect Article Number"
Me.Textan.Value = ""
Exit Sub
End If
With Me
Textan1 = Application.WorksheetFunction.VLookup(CLng(Me.Textan), Sheet2.Range("Lookup"), 2, 0)
Textan2 = Application.WorksheetFunction.VLookup(CLng(Me.Textan), Sheet2.Range("Lookup"), 3, 0)
Textan3 = Application.WorksheetFunction.VLookup(CLng(Me.Textan), Sheet2.Range("Lookup"), 4, 0)
Textan4 = Application.WorksheetFunction.VLookup(CLng(Me.Textan), Sheet2.Range("Lookup"), 5, 0)
Textan5 = Application.WorksheetFunction.VLookup(CLng(Me.Textan), Sheet2.Range("Lookup"), 6, 0)
Textan6 = Application.WorksheetFunction.VLookup(CLng(Me.Textan), Sheet2.Range("Lookup"), 7, 0)
Textan7 = Application.WorksheetFunction.VLookup(CLng(Me.Textan), Sheet2.Range("Lookup"), 8, 0)
Textan8 = Application.WorksheetFunction.VLookup(CLng(Me.Textan), Sheet2.Range("Lookup"), 9, 0)
End With
End Sub
ありがとうございました。それは私の問題を解決しました –
あなたは大歓迎です。受け入れられた回答をマークすることができます。ありがとうございます – user3598756
@PouryaAshena https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235 – 0m3r