Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 49895

Vlookup other workbook open workbook on background

$
0
0
For my userforum I make a code with Vlookup to search for data in a other workbook, the code is working perfect. I like to work with different people together in one workbook
Only I have one question, is it possible to open the other workbook on the background, so other users are not deposited during their work.

I use this code:
Code:

Private Sub CmdZoekAddapt_Click()


Dim Search As Variant

Dim book1 As Workbook
Dim extwbk As Workbook
Dim x As Range


Set book1 = ThisWorkbook
Set extwbk = Workbooks.Open("C:\Users\admin\Desktop documenten\aanvragen overzicht.xlsm")
Set x = extwbk.Worksheets("aanvragen").Range("A7:x10000")

Search = txtZoek.Value
If IsNumeric(Search) Then Search = Val(Search)
If IsError(Application.Match(Search, x.Columns(1), 0)) Then
    MsgBox "Nummer niet bekend", vbCritical, Search
    Exit Sub
End If
txtJaar.Text = Application.WorksheetFunction.VLookup(Search, x, 18, False)
TxtMonsternr.Text = Application.WorksheetFunction.VLookup(Search, x, 2, False)
txtVersie.Text = Application.WorksheetFunction.VLookup(Search, x, 3, False)
txtKlant.Text = Application.WorksheetFunction.VLookup(Search, x, 4, False)
TxtVorm.Text = Application.WorksheetFunction.VLookup(Search, x, 5, False)
txtdeeg.Text = Application.WorksheetFunction.VLookup(Search, x, 6, False)
txtvulling.Text = Application.WorksheetFunction.VLookup(Search, x, 7, False)
TxtDecoratieA.Text = Application.WorksheetFunction.VLookup(Search, x, 8, False)
TxtDecoratieB.Text = Application.WorksheetFunction.VLookup(Search, x, 9, False)
txtopmerking.Text = Application.WorksheetFunction.VLookup(Search, x, 10, False)
TxtFoto.Text = Application.WorksheetFunction.VLookup(Search, x, 11, False)
txtaantal.Text = Application.WorksheetFunction.VLookup(Search, x, 12, False)
txtverpakking.Text = Application.WorksheetFunction.VLookup(Search, x, 13, False)

extwbk.Close savechanges:=False

End Sub


Viewing all articles
Browse latest Browse all 49895

Trending Articles