Spacing in Column headers

  • Thread starter Thread starter jacquie.levett
  • Start date Start date
J

jacquie.levett

Hi

I was wondering if anyone can give me a magic fix!

My company have developed a a system to track our current pursuits, my role is to export this data into Excel.

When the data pulls through, the 30+ column headers have no spacing, is there a quick way to fix this other than manually inputting the spaces?

Example below:

ProjectReference LeadProjectReference ProjectTitle


Thanks
Jac
 
Hi Jac,

Am Wed, 20 Nov 2013 02:31:49 -0800 (PST) schrieb
(e-mail address removed):

When the data pulls through, the 30+ column headers have no spacing, is there a quick way to fix this other than manually inputting the spaces?
ProjectReference LeadProjectReference ProjectTitle

try following code (modify the range to suit):

Sub Headers()
Dim rngC As Range
Dim i As Integer
Dim j As Integer
Dim n As Integer

For Each rngC In Range("A1:C1")
For i = 2 To Len(rngC)
For j = 65 To 90
n = InStr(i, rngC, Chr(j))
If n > 0 Then
If Mid(rngC, n - 1, 1) <> " " Then
rngC = Replace(rngC, Chr(j), " " & Chr(j))
i = n + 1
End If
End If
Next
Next
Next
End Sub


Regards
Claus B.
 
Back
Top