By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,711 Members | 1,364 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,711 IT Pros & Developers. It's quick & easy.

What is wrong with this VBA CODE

P: 1
What is wrong with the following code :
Expand|Select|Wrap|Line Numbers
  1. If C.SentOn <> "" Then
It keeps erroring. The same code runs perfectly in other modules.
Mar 15 '14 #1
Share this Question
Share on Google+
2 Replies


Seth Schrock
Expert 2.5K+
P: 2,951
If C.SentOn is null, then you will get an error because you can't compare null to anything. If this is the problem, then the fix would be
Expand|Select|Wrap|Line Numbers
  1. If C.SentOn & "" <> "" Then
By concatenating a zero-length string to C.SentOn, you make it not null without changing the value that you are comparing.
Mar 15 '14 #2

NeoPa
Expert Mod 15k+
P: 31,769
I'm sure if the code errors then it will give number and description information about the particular error. This essential information is missing from your question for some reason.
Mar 15 '14 #3

Post your reply

Sign in to post your reply or Sign up for a free account.