Converting values based on variable type
I have rows with data. One collumn tells what type of value the data for that row is. For example, cell(1,A) = Integer and cell(1,B) = 5. The problem is in discrepencies between the designated type in column A and the actual value in column B. How do I error check to make sure the value is correct for its type? Or how do I convert the value to be correct for its type?
Re: Converting values based on variable type
You can use the type converter funtions like CInt to convert to an Integer. Press F2 and search in the
Object Browser for the rest or also check out the help file for a more difinative description.
Re: Converting values based on variable type
I don't want to change the type, I want to change the value. If I change "hello" to an integer type, it's still not an integer value and I get an error.
Re: Converting values based on variable type
But in your first post you said you wanted to convert to that type? How are you expecting the text
type "hello" to equal a Integer value? Ascii conversion of ???
Re: Converting values based on variable type
How do I check to see if a value is a string? IsStr$() doesn't seem to work. I don't want to check the type I want to see if the actual value is a String value. Thanks for help!
Re: Converting values based on variable type
Oh, will the cell be formatted to hold the correct data type? If so we can just get the cell formatting to determine the type.
Re: Converting values based on variable type
Would formatting the cell change the value if the user put a numeric in a string-formatted cell?
Re: Converting values based on variable type
It depends on the data types, I suppose.
If you format a column as Text and place a numeric value in it then it will not
change it. Also, if you formatted a numeric column and added text then you
would be ok too. ;)