|
-
Mar 11th, 2005, 02:09 PM
#1
Thread Starter
Lively Member
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?
"Some love is fire, some love is rust. But the finest, cleanest love is lust." - James Bond
-
Mar 11th, 2005, 09:14 PM
#2
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 13th, 2005, 12:55 PM
#3
Thread Starter
Lively Member
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.
"Some love is fire, some love is rust. But the finest, cleanest love is lust." - James Bond
-
Mar 13th, 2005, 12:59 PM
#4
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 ???
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 13th, 2005, 01:07 PM
#5
Thread Starter
Lively Member
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!
Last edited by Daniel McCool; Mar 13th, 2005 at 01:17 PM.
"Some love is fire, some love is rust. But the finest, cleanest love is lust." - James Bond
-
Mar 13th, 2005, 01:47 PM
#6
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 13th, 2005, 04:49 PM
#7
Thread Starter
Lively Member
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?
"Some love is fire, some love is rust. But the finest, cleanest love is lust." - James Bond
-
Mar 13th, 2005, 11:16 PM
#8
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|