Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2007

Tip: Looking for answers? Try searching our database.

return type of a field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nasir - 30 Jan 2007 13:11 GMT
My goal is to find the return type of a field. I have created a
customized right click menu. A user can right click and then choose
"conversion" option to convert the cell value, either from hours to
decimal or from decimal to hours. It is working fine.
The problem is: the program should be able to find out the difference
between hours and decimal value. To my understanding, the program
takes the value as "double" irrespective of the value in hours or
decimals.
Can I get some help here in figuring out the hour type ? I want to
display the alert message if the user try to convert hours to hour or
decimal to decimal. I can only do that if I can find out the cell
value in hours and decimals independently.
Thanks in advance,
Bob Phillips - 30 Jan 2007 13:27 GMT
Try something like this

   Select Case TypeName(Val)
       Case "Integer": MsgBox "Integer"
       Case "Double": MsgBox "Double"
   End Select

where Val is a variant variable.

Signature

HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

> My goal is to find the return type of a field. I have created a
> customized right click menu. A user can right click and then choose
[quoted text clipped - 9 lines]
> value in hours and decimals independently.
> Thanks in advance,
Nasir - 30 Jan 2007 13:48 GMT
Perhaps I didn't explain well in my previous post.
The problem: suppose we have a cell value as "175:12" the answer in
decimal would be "175.2". However, if I try to convert(wrongly) from
hours value to hours then I should be able to display the alert
message as "value is in hours already, please choose a decimal value".
Same should happen for an attempt to convert decimal to decimal. For
example, converting "175.2" to hours should display "175:12". However,
if by mistake the user click convert to decimal for a decimal value,
then there should be the alert message as "value in decimal already,
please choose an hour value".
TypeName() returns "double" for both hours and decimal. I was
wondering, if I could get the return type as hours or some different
return type for decimal and hours, then I could perhaps use that in an
"if-else" block to do the needful.
I am hoping to get some help in this regard, thanks again.

> Try something like this
>
[quoted text clipped - 25 lines]
> > value in hours and decimals independently.
> > Thanks in advance,- Hide quoted text -- Show quoted text -
Nasir - 30 Jan 2007 16:30 GMT
I got the solution, and it is posted on excel programming.
Thanks
Nasir.

> Perhaps I didn't explain well in my previous post.
> The problem: suppose we have a cell value as "175:12" the answer in
[quoted text clipped - 41 lines]
> > > value in hours and decimals independently.
> > > Thanks in advance,- Hide quoted text -- Show quoted text -- Hide quoted text -- Show quoted text -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.