Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


change numeric values to text

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,2552
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> change numeric values to text
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 change numeric values to text - 4/3/2005 9:30:09 PM   
  yiksun

 

Posts: 2
Score: 0
Joined: 4/3/2005
From:
Status: offline
I want to write a macro that can change numeric values in cells to text.
Here is my code but it doesn't work.

Sub changeType()
For Each n In Range("C1:C13") ' Substitute your range here
n.Value = "'" + n.Value
Next n
End Sub

Could anyone help me to solve the problem?
Thx
 
 
Post #: 1
 
 Re: change numeric values to text - 4/4/2005 2:05:11 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Replace:

n.Value = "'" + n.Value

with:

n.Value = cstr(n.Value)

(in reply to yiksun)
 
 
Post #: 2
 
 Re: change numeric values to text - 4/4/2005 4:15:42 AM   
  yiksun

 

Posts: 2
Score: 0
Joined: 4/3/2005
From:
Status: offline
Thanks a lot!

(in reply to yiksun)
 
 
Post #: 3
 
 Re: change numeric values to text - 4/4/2005 9:47:41 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
No problem =)

(in reply to yiksun)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> change numeric values to text Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts