I'm not sure how to wrap a VBA function as I am getting the error "Compile error: For without Next" Here is my code
Sub RenameHeadersZoomInfo()
Dim ws As Worksheet
Set ws = ThisWorkbook.ActiveSheet
Dim rng As Range
Dim LastCol As Long
LastCol = ws.Cells(1, ws.Columns.Count).End(xIToLeft).Column
For Each rng In ws.Range(ws.Cells(1, 1), ws.Cells(1, LastCol))
Select Case rng.Value
Case "Company Name"
rng.Value = "Name"
Case "Country"
rng.Value = "BillingCountry"
Case "City"
rng.Value = "BillingCity"
Case "State"
rng.Value = "BillingState"
Case "LinkedIn Company Profile URL"
rng.Value = "LinkedinCompanyPage__c"
Case "Owner"
rng.Value = "Owner.Id"
Case "Primary Sub-Industry"
rng.Value = "LinkedinIndustry__c"
Case "Company HQ Phone"
rng.Value = "Phone"
Case "NAICS Code 1"
rng.Value = "NAICSCode_1__c"
Case "NAICS Code 2"
rng.Value = "NAICSCode_2__c"
Case "Show"
rng.Value = "Description"
End Select
End Sub
I edited this VBA code with the help of ChatGPT...
Running it, I had a first error telling me I needed to have an End Select.
So I added the End Select
at the end of the Select Case function.
Then running the code I get the new error "For without Next".
I tried adding a Next Cell line
after the End Select
but its not working.