I just noticed I incremented rows not columns so my commands should read:


myExcelWrk.Cells(1,i).Value = trim(myExcelWrk.Cells(1,i).Value))


for example.

The last post's code should be:


dim end_of_headers_found as boolean
dim i as integer

end_of_headers_found = false
i = 1

do until end_of_headers_found
myExcelWrk.Cells(1,i).Value = trim(myExcelWrk.Cells(1,i).Value))

if len(trim(myExcelWrk.Cells(1,i).Value)) < 1 then
end_of_headers_found=true
end if

i=i+1

loop