I've got a macro for the purpose of standardizing column headings on data received from numerous different sources. I'm using a different dictionary for each relevant column, and it works great, but I'm curious if there's a better / different way of doing it?
Here's a snippet of the macro capped at 5 entries per dictionary for this example. There's many more dictionaries and entries in the dictionaries than displayed here - I'm just looking to see if there's a better way.
Here's a snippet of the macro capped at 5 entries per dictionary for this example. There's many more dictionaries and entries in the dictionaries than displayed here - I'm just looking to see if there's a better way.
VBA Code:
'**********************************************
Dim AgencyName As New Scripting.Dictionary
AgencyName.CompareMode = TextCompare
AgencyName.Add "ProvName", 1
AgencyName.Add "FACIL_NM", 1
AgencyName.Add "Svc Prov Org Name", 1
AgencyName.Add "Serv Group Practice Name", 1
AgencyName.Add "Billing Prov LName", 1
'***********************************************
'*********************************************
Dim AgencyProviderNumber As New Scripting.Dictionary
AgencyProviderNumber.CompareMode = TextCompare
AgencyProviderNumber.Add "PayToProviderNumber", 1
AgencyProviderNumber.Add "clinic_npi", 1
'**********************************************
'**********************************************
Dim BilledAmount As New Scripting.Dictionary
BilledAmount.CompareMode = TextCompare
BilledAmount.Add "SUBMITTED", 1
BilledAmount.Add "Submitted Charge", 1
BilledAmount.Add "billed_amt", 1
BilledAmount.Add "Billed Amt", 1
BilledAmount.Add "BILLED AMOUNT", 1
'***********************************************
Range("A1").Select
For X = 1 To LastColumn
Z = Cells(1, X)
If xRecipID.Exists(Z) Then
ActiveCell.Value = "Recipient ID"
ElseIf AgencyName.Exists(Z) Then
ActiveCell.Value = "Agency Name"
ElseIf AgencyProviderNumber.Exists(Z) Then
ActiveCell.Value = "Agency Provider Number"
ElseIf AgencyType.Exists(Z) Then
ActiveCell.Value = "Agency Type"
ElseIf BilledAmount.Exists(Z) Then
ActiveCell.Value = "Billed Amount"
End If
Next X