I have a problem where I'm not sure where to begin. I know that using temp sh is probably the best way to start. I have 110 columns that a fellow programmer misnamed the header attributes. Since this is an external data source (*.csv), I have no control to rename the attributes correctly. What I want to do is loop through the header row and rename each attribute correctly. For example c1 (incorrect) would be renamed to HC1 (correct)...etc.
I know this would be fairly simple since I would just match ws1.Cell(1,1) with ws2.Cell(1,i) and replace ws1.Cell(1,1) with Found ws2.Cell(1,i).Offset(0,1)...something like:
Dim i As Integer
Dim Var2Find As String
Set wb = ThisWorkbook
Set ws1 = wb.Sheets(1)
Var2Find = ws1.Range(ws1.Cells(2, 1), ws1.Cells(2, lRow)).Value
Set wb = ThisWorkbook
Set ws2 = wb.Sheets(2)
With ws2
lCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
For i = 1 To lCol
If .Cells(1, i).Value = Var2Find Then
Var2Find.Offset(0, 1).Copy .Cells(1, i)
End If
Next i
End With
Bookmarks