Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default range data type

how do I set a range's data type using VB? I wrote a vb
app to parse data into a csv file. Then I open the csv
into excel and populate the columns. Now I need to set
the columns to text instead of the numbers being treated
like numbers.



thx
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default range data type

You don't

you can format a cell, but since your value is already stored there, it will
have no effect.

columns(1).NumberFormat = "@"
formats a column as Text.

To make the numbers text after the fact you would have to do

With Activesheet
for each cell in Intersect(.Columns(1),.UsedRange)
if isnumeric(cell.Value) then
cell.Value = "'" & cell.Value
' or cell.Value = "'" & cell.Text
end if
Next
End With

--
Regards,
Tom Ogilvy

"seanw" wrote in message
...
how do I set a range's data type using VB? I wrote a vb
app to parse data into a csv file. Then I open the csv
into excel and populate the columns. Now I need to set
the columns to text instead of the numbers being treated
like numbers.



thx



  #3   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default range data type

Generally, if you set the format of the cells in the
worksheet to Text and then PasteSpecial Values the CSV
file in, the numbers should format as if they were text.


-----Original Message-----
how do I set a range's data type using VB? I wrote a vb
app to parse data into a csv file. Then I open the csv
into excel and populate the columns. Now I need to set
the columns to text instead of the numbers being treated
like numbers.



thx
.

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
ODBC Driver Manager: Option type out of range TerryM Excel Discussion (Misc queries) 4 April 13th 10 05:33 PM
Excel x,y chart type x range must be re-entered each series Thomas R. Glass Charts and Charting in Excel 1 February 8th 06 11:23 PM
Type mismatch in VBA LinEst function if range too large RyanVM[_16_] Excel Programming 4 August 10th 04 02:47 AM
Range type variable oddness Nick Excel Programming 7 July 26th 04 09:42 AM
How to add an argument to every cell in a range containing same type formula?? foamfollower Excel Programming 2 January 21st 04 03:29 AM


All times are GMT +1. The time now is 02:13 PM.

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

About Us

"It's about Microsoft Excel"