Set a column to "text"

J

JimS

I'm using Office 2007, using the Excel object model from Access VBA. I want
to select a column (say, column G), then turn it all to text. It may contain
mostly numbers, but I want Excel (and ultimately Access) to see the entire
column as text. There is a way to do this manually, but I need to do it
through VBA. Anybody got a quick code snippet they could share? I'd
appreciate it....
 
R

Rick Rothstein

I don't use Access, so I'm not sure about requirements, if any, for running
the Excel object model from within it; however, the VBA statement that
formats Column "G" as Text is this...

Columns("G").NumberFormat = "@"
 
T

Tom Lavedas

I'm using Office 2007, using the Excel object model from Access VBA. I want
to select a column (say, column G), then turn it all to text. It may contain
mostly numbers, but I want Excel (and ultimately Access) to see the entire
column as text. There is a way to do this manually, but I need to do it
through VBA. Anybody got a quick code snippet they could share? I'd
appreciate it....

Have you tried this? ...

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 10/08/2009 by Tom Lavedas
'

'
Columns("G:G").Select
Selection.NumberFormat = "@"
End Sub
_____________________
Tom Lavedas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top