Problem with Vlookup in VBA

I am trying to use Vlookup in a macro but can't get it to Work.
I have a sheet called "Pivot" and a sheet called "Data2".
I build a new sheet called "Raabalance" with data from both sheets with this code:

Sub Opdaterdata()
Dim i_rowidx1, i_rowidx2, i_rowidx3 As Integer
Dim rngstart As Range
Dim primo As Currency
Dim k_nr As String
'On Error GoTo Fejl

Set rngstart = Worksheets("Pivot").Range("A1")
i_data1_idx = rngstart.CurrentRegion.Rows.Count

On Error Resume Next

i_vareliste_idx = 2
For i = 2 To i_data1_idx

  k_nr = Worksheets("Pivot").Cells(i, 1)
  primo = 0
'  primo = [VLOOKUP(k_nr, Data2!A1:X200, 2, FALSE)]
' primo = Application.VLookup(k_nr, Tabel_Forespørgsel_fra_EGDTA1, 2, 0)
' primo = Worksheet.VLookup(k_nr, Tabel_Forespørgsel_fra_EGDTA1, 2, 0)
'  primo = Application.WorksheetFunction.VLookup(k_nr, Tabel_Forespørgsel_fra_EGDTA1, 2, 0)
'  primo = Application.Worksheet.VLookup(k_nr, Tabel_Forespørgsel_fra_EGDTA1, 2, 0)
'  primo = Application.Worksheet.VLookup(k_nr, Tabel_Forespørgsel_fra_EGDTA1, 2, 0)
  'primo = Application.Worksheet.Function.VLookup(k_nr, Tabel_Forespørgsel_fra_EGDTA1, 2, 0)
  primo = Application.WorksheetFunction.VLookup(k_nr, "Data2!a1:x400", 2, 0)
  Worksheets("Raabalance").Cells(i_vareliste_idx, 1).Value = Worksheets("Pivot").Cells(i, 1)
  'Saldi januar-december
  Worksheets("Raabalance").Cells(i_vareliste_idx, 2).Value = Worksheets("Pivot").Cells(i, 2) + primo
  Worksheets("Raabalance").Cells(i_vareliste_idx, 3).Value = Worksheets("Pivot").Cells(i, 3) + primo
  Worksheets("Raabalance").Cells(i_vareliste_idx, 4).Value = Worksheets("Pivot").Cells(i, 4) + primo
  Worksheets("Raabalance").Cells(i_vareliste_idx, 5).Value = Worksheets("Pivot").Cells(i, 5) + primo
  Worksheets("Raabalance").Cells(i_vareliste_idx, 6).Value = Worksheets("Pivot").Cells(i, 6) + primo
  Worksheets("Raabalance").Cells(i_vareliste_idx, 7).Value = Worksheets("Pivot").Cells(i, 7) + primo
  Worksheets("Raabalance").Cells(i_vareliste_idx, 8).Value = Worksheets("Pivot").Cells(i, 8) + primo
  Worksheets("Raabalance").Cells(i_vareliste_idx, 9).Value = Worksheets("Pivot").Cells(i, 9) + primo
  Worksheets("Raabalance").Cells(i_vareliste_idx, 10).Value = Worksheets("Pivot").Cells(i, 10) + primo
  Worksheets("Raabalance").Cells(i_vareliste_idx, 11).Value = Worksheets("Pivot").Cells(i, 11) + primo
  Worksheets("Raabalance").Cells(i_vareliste_idx, 12).Value = Worksheets("Pivot").Cells(i, 12) + primo
  Worksheets("Raabalance").Cells(i_vareliste_idx, 13).Value = Worksheets("Pivot").Cells(i, 13) + primo
  i_vareliste_idx = i_vareliste_idx + 1
Next i

End Sub

The Vlookup for the value "Primo" is not working.

Cells from sheet "Pivot":
71112      0      0      -514,66      0      0      -514,66      0      0      -514,66      0      0      0

Cells from sheet "Data2"
71112      -2058,64

Please help...

Regards Bente
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saqib Husain, SyedEngineerCommented:
How about a sample file for testing. There might even be a problem with the data.
Saqib Husain, SyedEngineerCommented:

primo = Application.WorksheetFunction.VLookup(k_nr, range("Data2!a1:x400"), 2, 0)
AmandinaAuthor Commented:
Hi Saqib,
I tried your first comment, did not Work.
I have created a sample file with just a little data as it is confidental.
Hope you can help.
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Saqib Husain, SyedEngineerCommented:
Ok then try

primo = Application.WorksheetFunction.VLookup(Worksheets("Pivot").Cells(i, 1), Range("Data2!a1:x400"), 2, 0)
Ejgil HedegaardCommented:
k_nr is a string, but the lookup values on the sheet are numbers, so k_nr must be converted to a number, or vlookup fails.
primo = WorksheetFunction.VLookup(CLng(k_nr), Range("Data2!A1:X400"), 2, 0)

The table on the sheet is named "Tabel_Forespørgsel_fra_EGDTA3", and for named ranges [ ] brackets can be used, like this.
primo = WorksheetFunction.VLookup(CLng(k_nr), [Tabel_Forespørgsel_fra_EGDTA3], 2, 0)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Roy CoxGroup Finance ManagerCommented:
When you are developing code do not use error handlers until the code actually works. If you do then possible error alerts that may help will be stopped.

Instead of VLOOKUP in Excel look at the .Find method in VBA
AmandinaAuthor Commented:
Saqib Husain, SyedEngineerCommented:
Does that mean that the second formula I gave did not work?
AmandinaAuthor Commented:
No, it did not Work.  The problem was the difference between string and numbers.  But thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.