Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default convert text to number


Hi, I have a sheet that I use to keep track of vacations.
In it, if a cell has the entry of "Vac", I want the
assumption it is for 8 hours in the cell below, so I have
a formula like this: =IF(ISTEXT(L5),"8.0",""). It works
OK. (The idea is that most of the time it will be 8 hours,
users can change it if required).

Problem is when I add all the Vac cells in VB code, it
treates the entries in the IF cells as String so
concatinates the numbers. I have the cell defined as
numbers, the variable in code is defined as integer.

If I change the '8.0' that the IF statement generates with
8, the macro works as advertised.

Any help is appreciated...........Herb



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default convert text to number

Herb,

You could change your formula:
=IF(ISTEXT(L5),8.0,"")

Or within VB change your string to a value.
FRom the immediate window assuming that your original formula
is in cell L4

?val(range("L4"))

John


"Herb" wrote in message
...

Hi, I have a sheet that I use to keep track of vacations.
In it, if a cell has the entry of "Vac", I want the
assumption it is for 8 hours in the cell below, so I have
a formula like this: =IF(ISTEXT(L5),"8.0",""). It works
OK. (The idea is that most of the time it will be 8 hours,
users can change it if required).

Problem is when I add all the Vac cells in VB code, it
treates the entries in the IF cells as String so
concatinates the numbers. I have the cell defined as
numbers, the variable in code is defined as integer.

If I change the '8.0' that the IF statement generates with
8, the macro works as advertised.

Any help is appreciated...........Herb





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 to convert number to text Medegypt Excel Worksheet Functions 2 February 26th 09 05:20 PM
Convert text to number scubadiver Excel Discussion (Misc queries) 3 July 8th 07 02:37 PM
Convert text number to number formate [email protected] Excel Discussion (Misc queries) 2 April 9th 07 10:48 AM
convert text-format number to number in excel 2000%3f Larry Excel Discussion (Misc queries) 1 July 29th 05 08:18 PM
not able to convert text, or graphic number to regular number in e knutsenk Excel Worksheet Functions 1 April 2nd 05 08:41 AM


All times are GMT +1. The time now is 11:14 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"