Mapping Column Headers for Export

ctackett6407

Board Regular
Joined
Mar 18, 2018
Messages
66
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone!

I'm digging around the ole Google world to see if something is possible or if software exists.

I current can export a file from a vendor and it contains information that I want to import to another vendor. The issue is the column names do not match so I have to stop and tweak the exports every time.

I'm trying to find a faster solution to this.

Any thoughts?

Example

Export has headers like Member ID, SVC address etc...
I want to find a way .. macro etc that will automatically change the export fields to Account No, Address etc...
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
maybe like this - assumes the worksheet to change is active & the headers are in row 1
could be in your personal macros and run on a keystroke shortcut

Code:
Sub ChangeHeaders()


    'https://www.mrexcel.com/forum/excel-questions/1086498-mapping-column-headers-export.html


    Dim i As Long
    Dim asChangeFrom As Variant
    Dim asChangeTo As Variant
    
    asChangeFrom = Array("Member ID", "SVC address", "etc")
    asChangeTo = Array("Account No", "Address", "etcetera")


    For i = LBound(asChangeFrom) To UBound(asChangeFrom)
        Rows(1).Replace What:=asChangeFrom(i), replacement:=asChangeTo(i), LookAt:=xlWhole
    Next i
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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