
Signature
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS
Thanks Nick and DM, your suggestions pointed me down a path that lead to
success :-)
After much googling, here's what I came up with that worked for me.
I ended up doing a Format Cells on the 3 columns that contained phone
numbers, and then wrote a macro to perform "Text to Columns" when the
"AfterRefresh" event ocurred (i.e. after the query refreshed and pulled
all the data in, then do the TextToColumns code).
The key
Here's the code:
==========================
Excel Objects:ThisWorkbook
==========================
Private Sub Workbook_Open()
Initialize_It
End Sub
==========================
Module:Module1
==========================
Dim X As New Class1
Sub Initialize_It()
Set X.qt = ThisWorkbook.Sheets(1).QueryTables(1)
End Sub
==========================
Class Modules:Class1
==========================
Public WithEvents qt As QueryTable
Private Sub qt_AfterRefresh(ByVal Success As Boolean)
FormatPhoneNumbers
End Sub
Public Sub FormatPhoneNumbers()
Dim objRange1 As Range
Dim objRange2 As Range
Dim objRange3 As Range
Dim objRange4 As Range
'Set up the ranges
Set objRange1 = Range("N:N")
Set objRange2 = Range("O:O")
Set objRange3 = Range("P:P")
Set objRange4 = Range("L:L")
'Parse the N column, Telephone Work
objRange1.TextToColumns _
Destination:=Range("N1"), _
DataType:=xlDelimited, _
Tab:=True, _
Semicolon:=False, _
Comma:=False, _
Space:=False, _
Other:=False, _
OtherChar:="-"
'Parse the O column, Telephone Cell
objRange2.TextToColumns _
Destination:=Range("O1"), _
DataType:=xlDelimited, _
Tab:=True, _
Semicolon:=False, _
Comma:=False, _
Space:=False, _
Other:=False, _
OtherChar:="-"
'Parse the P column, Fax
objRange3.TextToColumns _
Destination:=Range("P1"), _
DataType:=xlDelimited, _
Tab:=True, _
Semicolon:=False, _
Comma:=False, _
Space:=False, _
Other:=False, _
OtherChar:="-"
'Parse the L column, Fax
objRange4.TextToColumns _
Destination:=Range("L1"), _
DataType:=xlDelimited, _
Tab:=True, _
Semicolon:=False, _
Comma:=False, _
Space:=False, _
Other:=False, _
OtherChar:="-"
End Sub
Nick Hodge said the following on 06/20/2005 16:25:
> Mike
>
[quoted text clipped - 8 lines]
>
> ="("&LEFT(A1,3)&") "&MID(A1,5,4)&"-"&RIGHT(A1,4)
aaron.kempf@gmail.com - 22 Jun 2005 07:01 GMT
hey bud; start using databases; Excel is worthless and too buggy to use
as a repository
-Aaron
greaseman - 11 Jul 2006 22:13 GMT
Golly..... over a year of absolutely stupid, worthless and useless
aaron-isms. I'm thinking more and more that Microsoft canned him after
they discovered he had a lobotomy.

Signature
greaseman