Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

While Wend Loop Problem

Posted on 2013-12-27
8
221 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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
 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

808 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