I was hoping someone can shed some more light on variable types in VBA for me.
I understand that integer & long integer are for numbers only but when it comes to the rest like string, fixed string, variant, boolean, object, & Byte I am a little more confused.
I have written a formula before and used a variable type as string but was getting an error message. I changed the variable type to variant and the code worked. Not sure why it worked and why I needed to use the variant type in the code.
How do you know which variable type to use in your VBA coding?
Please help if you can, Thanks!
I understand that integer & long integer are for numbers only but when it comes to the rest like string, fixed string, variant, boolean, object, & Byte I am a little more confused.
I have written a formula before and used a variable type as string but was getting an error message. I changed the variable type to variant and the code worked. Not sure why it worked and why I needed to use the variant type in the code.
How do you know which variable type to use in your VBA coding?
Please help if you can, Thanks!