![]() |
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 |
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 |
All times are GMT +1. The time now is 07:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com