Help fixing a VBA formula using worksheet functions

This is the entire macro so far, as I said, right now it's nothing more than a test to see it grab the correct cell.

Sub Registreren() ' ' Registreren Macro '

' 'Name 'invullijst' workbook and worksheets Dim wbinvul As Workbook Dim wsinvul As Worksheet Dim sourcerange As Range

'Name 'masterbestand' workbook and worksheets Dim wbmaster As Workbook Dim wsaantal As Worksheet Dim wsopbrengst As Worksheet Dim destrange As Range

'Set wbinvul as activeworkbook Set wbinvul = ActiveWorkbook Set wsinvul = wbinvul.Worksheets("Invullijst") Set sourcerange = Workbooks("Kassa Administratie (INVULBESTAND).xlsm").Sheets("Invullijst").Range("A:F")

'Open and set wbmaster Workbooks.Open ("H:/Kassa Administratie (MASTERBESTAND)") Set wbmaster = Workbooks("Kassa Administratie (MASTERBESTAND)") Set wsaantal = wbmaster.Worksheets("Aantallen") Set wsopbrengst = wbmaster.Worksheets("Opbrengsten") Set destrange = Workbooks("Kassa Administratie (MASTERBESTAND).xlsm").Sheets("Aantallen").Range("A:X")

'Select Cell Set wbmaster = ActiveWorkbook MsgBox "Entered value is" & Range(Application.WorksheetFunction.Index('[Kassa Administratie (MASTERBESTAND).xlsm]Aantallen'!R1:R1048576,(Application.WorksheetFunction.Match(Range("'[Kassa Administratie (INVULBESTAND).xlsm]Invullijst'!B17"), Range("'[Kassa Administratie (MASTERBESTAND).xlsm]Aantallen'!2:2"), 0), Application.WorksheetFunction.Match(Range("'[Kassa Administratie (INVULBESTAND).xlsm]Invullijst'!F3"), Range("'[Kassa Administratie (MASTERBESTAND).xlsm]Aantallen'!A:A"), 0))).Value

End Sub

/r/excel Thread