Thread
:
Spacing in Column headers
View Single Post
#
2
Posted to microsoft.public.excel.worksheet.functions
Claus Busch
external usenet poster
Posts: 3,872
Spacing in Column headers
Hi Jac,
Am Wed, 20 Nov 2013 02:31:49 -0800 (PST) schrieb
:
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.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
Reply With Quote
Claus Busch
View Public Profile
Find all posts by Claus Busch