While Wend Loop Problem

Hi Guys, I have a While....Wend Macro which loops down a Column and then populates  Column AD of my attachment depending on which IF condition has been satisfied. For some reason, on some occasions it has populated the wrong comment in column AD.I have copied and pasted these Exceptions onto the tab "Exceptions" in my attachment. The biggest culprit is the the comment " On-dashboard- f/e error". Can someone find out why this is happening?
DummyRec11.xlsm
JustincutAsked:
Who is Participating?
 
Martin LissConnect With a Mentor Older than dirtCommented:
I assume that the code in the workbook that you attached is a stripped down version of your real workbook and that there are other procedures in addition to Nonvalidated2 in the real workbook. It must be one of those procedures that is placing the "On dashboard - non-validated trade" message in column because I guarantee you that Nonvalidated2 is not doing it.

Note however that in Nonvalidated2 that the columns you are referring to may not be the ones you intend because for one thing if you mean for the numbers 29, 30, etc in row one to be the column numbers they're not and AD should be 30, AE should be 31, etc.

Here's a simple function you can call to verify the column number to column letter relationship.
Function ColNumToLetter(lColNum As Long) As String
' Convert numeric to column letter
 
    ColNumToLetter = Split(Cells(1, lColNum).Address, "$")(1)
End Function

Open in new window

0
 
Martin LissOlder than dirtCommented:
54 is column BB. Is that the column you want to look at?
0
 
JustincutAuthor Commented:
Yep.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
Martin LissOlder than dirtCommented:
Well I did the following and every 'i' that printed had a value in column BB, so what's wrong?

ElseIf Cells(i, 54).Value <> "" Then
Cells(i, 30).Value = "On dashboard - f/e error"
Debug.Print i
Cells(i, 31).Value = "BAU - Dashboard"
Cells(i, 32).Value = "JC"
Cells(i, 33).Value = 0
Cells(i, 34).Value = "GL Incorrect"
0
 
JustincutAuthor Commented:
Did you use the Immediate window for this? I think the Lookup in the Range "Errors" has inexplicably shown a value of 0 for some cells and this has triggered the Macro.

Can you have a look at some of the other Values that have appeared in the "Exceptions" tab?
0
 
Martin LissOlder than dirtCommented:
Yes I used the Immediate Window.

Rather than me looking through every test for every cell, why don't you just point out a row or two on the Rec sheet that you believe are incorrectly being flagged as errors.
0
 
JustincutAuthor Commented:
Hi, the same has happened on today's Rec too. I have shaded in Purple all the Cells in AD which are wrong. Although column BA says "NA#", its populated column AD with the comment "On dashboard - non-validated trade" It should only populate this comment if column BA does not say "NA#". Can you loop through and find out why?
Dummyfile12.xlsm
0
 
Martin LissOlder than dirtCommented:
Did my comments above help you?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.