View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Brett Smith[_2_] Brett Smith[_2_] is offline
external usenet poster
 
Posts: 54
Default Why is my code not working the way I intend it to?

Thanks for Chiming in JE McGimpsey,

So what should I do differently? Any suggestions? Thanks ahead of time!

"JE McGimpsey" wrote:

Without going through all the code, it appears that you assign a null
string to NVariable if the N field is empty. You then have a series of
test like:


ElseIf (IsEmpty(NVariable) And NVariable = "" And _
Not IsEmpty(MVariable)) Then

If NVariable is assigned a null string, then that test will always
return False since IsEmpty(NVariable) will be False.

In article ,
"Brett Smith" wrote:

I have created a Macro that formats the fields of a worksheet and then
exports it into a txt file. My problem is it displays the information coming
from the N and M fields, but if there is nothing in the N field, it doesn't
display the information from the M field either. What I need is if there is
any information coming from either one, it should show up in the exported
text file? Why is information not being displayed if one of the fields is
missing in the export? Below is the code.