Does anyone know why this line of code won't work? I'm trying to define Date as the contents of cell "A2".
Please Login or Register to view this content.
Does anyone know why this line of code won't work? I'm trying to define Date as the contents of cell "A2".
Please Login or Register to view this content.
Date is a reserved word in VBA, so it shouldn't be used as a variable name.
On the right of the assignment operator, Date is a native VBA function that returns the date. On the left, it is a statement that sets the date. Choose a different variable name.
Entia non sunt multiplicanda sine necessitate
I personally find putting 'My' before a variable name helps to ease these problems.
For example: myDate, myRange, myObject
Hope this helps.
abousetta
Please consider:
Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.
I like the tip from PED - give each variable a prefix letter according to the variable type, e.g.
lMyVar is a long, iMyVar is an integer, sMyVar is a string ... and so on. Simple to do, but it does make re-reading old code much easier.
Completely agree with Andrew.
variations of the Hungarian naming conventions are popular http://en.wikipedia.org/wiki/Leszyns...ing_convention
Josie
if at first you don't succeed try doing it the way your wife told you to
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks