Match index from another file

Palucci

Board Regular
Joined
Sep 15, 2021
Messages
92
Office Version
  1. 365
Platform
  1. Windows
Hello,
I hope are you can help me. I have two files, one with data and one empty to complete from the data file. I have the same header names but they are in a different order. I need one button to make a match and copy the values to an empty sheet.
This is file with date columns A;E

241896627_2989153934675212_4396392629752429910_n.jpg


and this is empty headers
ddd.jpg
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Palucci

Board Regular
Joined
Sep 15, 2021
Messages
92
Office Version
  1. 365
Platform
  1. Windows
Private Sub CommandButton2_Click()

Const swsName As String = "Sheet1"
Const sRow As Long = 1

Const dFilePath As String _
= "C:\Users\admin\Documents\sample.xlsx"
Const dwsName As String = "Arkusz1"

Dim swb As Workbook: Set swb = ThisWorkbook
Dim sws As Worksheet: Set sws = swb.Worksheets(swsName)
Dim srg As Range: Set srg = sws.Rows(sRow)

Application.ScreenUpdating = False

Dim dwb As Workbook: Set dwb = Workbooks.Open(dFilePath)
Dim dws As Worksheet: Set dws = dwb.Worksheets(dwsName)
Dim dCell As Range
Set dCell = dws.Cells(dws.Rows.Count, "A").End(xlUp).Offset(1)
 

Forum statistics

Threads
1,144,282
Messages
5,723,474
Members
422,499
Latest member
think say

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
Top