Solved

While Wend Loop Problem

Posted on 2013-12-27
8
198 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 45

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 45

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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 45

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 45

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 45

Expert Comment

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

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

746 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

9 Experts available now in Live!

Get 1:1 Help Now