Retrieve data from an Excel table into another table.

julietterichelieu

New Member
Joined
Feb 14, 2022
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I would like to retrieve data from an Excel table into another table.

In my table I have to retrieve in column AX, the data according to two criteria in column E and in column F

If in column E there is "VMO" and in column F there is "EKZEK" then take the value in column "AX" on the same line and give me the value "215" in cells N14 for example

1644850005004.png


Is it possible??

Thanks in advance
 

Attachments

  • 1644849929050.png
    1644849929050.png
    24.3 KB · Views: 10
Try:
VBA Code:
Sub retrieveData()
    Application.ScreenUpdating = False
    Dim v As Variant, i As Long, x As Long, srcWS As Worksheet, desWS As Worksheet, desRng As Range
    Set srcWS = Sheets("Data")
    Set desWS = Sheets("Inventaire")
    Set desRng = desWS.Range("B2", desWS.Range("B" & Rows.Count).End(xlUp))
    v = srcWS.Range("E2", srcWS.Range("E" & Rows.Count).End(xlUp)).Resize(, 9).Value
    For i = 1 To UBound(v)
        If v(i, 1) = "VMOB" Then
            If Not IsError(Application.Match(v(i, 2), desRng, 0)) Then
                x = Application.Match(v(i, 2), desRng, 0)
                With desWS
                    .Range("D" & x + 1).Resize(, 2).Value = Array(v(i, 8), v(i, 9))
                End With
            End If
        End If
    Next i
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,215,516
Messages
6,125,286
Members
449,218
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top