Typecast

priya_anthony

Board Regular
Joined
Jul 17, 2007
Messages
64
Hi experts
Need your help
What am i looking out is to type cast the data i.e numeric to string
i.e i retrieve the data as "001" from the database which is numeric and when i type cast it to a string it gives only 1
i.e
Str(oPersonHelp.Value(R, C)---'it contains the value 001)
i want the same data i.e 001 instead of 1

kindly help
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
The numeric data is not 001 - it is just formatted to look that way.
So you need to format the string the way you want with something like :-

Code:
Dim MyText as string
MyText = Format(oPersonHelp.Cells(R, C).Value,"000")
 
Upvote 0
Use Text instead of Value.

That will return the value as it is formatted, if that's what you want.:)
 
Upvote 0

Forum statistics

Threads
1,213,532
Messages
6,114,176
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top