Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Set a column to "text"

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....

--
Jim
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Set a column to "text"

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 = "@"

--
Rick (MVP - Excel)


"JimS" wrote in message
...
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....

--
Jim


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Set a column to "text"

On Oct 8, 3:50*pm, JimS wrote:
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....

--
Jim


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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text "comparison" operator for "contains" used in an "IF" Function Pawaso Excel Worksheet Functions 4 April 4th 23 11:35 AM
How do I change the column heading in Excel to display "A" "B" "C Thai New Users to Excel 1 November 30th 07 08:06 PM
Please add a "sheet" function like "row" and "column" functions Spreadsheet Monkey Excel Programming 2 November 8th 05 04:08 PM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM
How do I split "A1B2" into "A1" and "B2" using text to column fun. Jennifer Excel Programming 1 February 2nd 05 10:01 PM


All times are GMT +1. The time now is 02:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"