Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default How convert a cell subtype? (from vbDouble to vbString)

As shown by JE you need to set the numberformat to text eg:

With Cells(1, 7)
.NumberFormat = "@"
.Value = .Text
End With

However, reading you post in excel.misc I would have thought it is the
cells that are a string datatype that you need to worry about not the
ones that are doubles as true excel times are stored as a double not a
string.

Regards
Rowan

Chet Shannon wrote:
Yeah you're right.. I didn't show but I then used a statement of
cells(1,7)=newvar after the and the cell still didn't change from sub-type 5
to sub-type 8. I thought maybe I had to clear out whatever was in cells(1,7)
first and that's why I did the cells(1,7).clear and then copied the newvar
(which is actually sub-type 8) into cells(1,7). But 1,7 is still type 5 not
8 as I wanted. I know I'm doing something fundamentally wrong.

If VarType(Cells(1, 7)) = 5 Then
newvar = CStr(Cells(1, 7))
Cells(1, 7).Clear
cells(1,7)=newvar
End If

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
How can I convert a text cell into date cell in Excel drocha Excel Discussion (Misc queries) 2 April 2nd 07 12:04 PM
convert number in cell to text in another cell Bill Excel Worksheet Functions 1 December 20th 05 10:31 PM
How convert a cell subtype? (from vbDouble to vbString) Rowan Drummond[_3_] Excel Programming 0 December 13th 05 04:25 AM
How convert a cell subtype? (from vbDouble to vbString) Chet Shannon[_4_] Excel Programming 0 December 13th 05 04:11 AM
How do you convert a formula cell to a constant cell JQLogan Excel Discussion (Misc queries) 1 March 29th 05 08:07 PM


All times are GMT +1. The time now is 07:20 PM.

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"