I have exported data from a database and i need to search through the column titles and copy the text(if any) in the cell below the title to another excel template.

I found code to import the csv and search through for the type of template needed but i don't know how to search through the column titles, select the cell below and copy the text(to an integer?) so i can move it to the template.

Any help on this would be greatly appreciated.

Also i'm not sure how to search through a correct the date format.

Below is a portioin of the imported CSV

Case Number Planned Start Date * Activity Type Service City
2108+1578-706 38365 Service Assist Sunderland


Here is code so far(it didn't fit well into this window, sorry)

Sub GetTextFileData(strSQL As String, strFolder As String, rngTargetCell As Range)
Dim cn As ADODB.Connection, rs As ADODB.Recordset, f, ActivityType As Integer
If rngTargetCell Is Nothing Then Exit Sub
Set cn = New ADODB.Connection
On Error Resume Next
cn.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};" & _
"Dbq=" & strFolder & ";" & _
"Extensions=asc,csv,tab,txt;"
On Error GoTo 0
If cn.State <> adStateOpen Then Exit Sub
Set rs = New ADODB.Recordset
On Error Resume Next
rs.Open strSQL, cn, adOpenForwardOnly, adLockReadOnly, adCmdText
On Error GoTo 0
If rs.State <> adStateOpen Then
cn.Close
Set cn = Nothing
Exit Sub
End If
' the field headings
For f = 0 To rs.Fields.Count - 1
rngTargetCell.Offset(0, f).Formula = rs.Fields(f).Name
Next f
rngTargetCell.Offset(1, 0).CopyFromRecordset rs ' works in Excel 2000 or later
'RS2WS rs, rngTargetCell ' works in Excel 97 or earlier
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
With Worksheets(1).Range("a1:aq4") 'Select the range for the find function
Set c = .Find("Activity Type", LookIn:=xlValues) ' Search for Activity Type
If Not c Is Nothing Then
firstaddress = c.Address
Workbooks.Add Template:="C:\Documents and Settings\bduncans\Application Data\Microsoft\Templates\Preventative Maintenance New Kit.xlt"
'c.Value = "Assisted"
'Set c = .FindNext(c)
End If
End With
End Sub