Solved

While Wend Loop Problem

Posted on 2013-12-27
8
208 Views
Last Modified: 2014-01-03
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
0
Comment
Question by:Justincut
  • 5
  • 3
8 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39742291
54 is column BB. Is that the column you want to look at?
0
 

Author Comment

by:Justincut
ID: 39742585
Yep.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39742605
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
 

Author Comment

by:Justincut
ID: 39742625
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 46

Expert Comment

by:Martin Liss
ID: 39742723
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
 

Author Comment

by:Justincut
ID: 39746699
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
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 39747051
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
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39751702
Did my comments above help you?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now