Solved

dO LOOP PROBLEM

Posted on 2013-12-20
4
249 Views
Last Modified: 2013-12-20
Hi Guys, I have a Do Loop problem where a series of If statements populates certain Cells. However, there is some problem with this bit of code and its over-running:

While Cells(i, 5).Value <> ""

i = i + 1

If Cells(i, 53).Text <> "#N/A" Then
Cells(i, 30).Value = "On dashboard - non-validated trade"
Cells(i, 31).Value = "BAU - Dashboard"
Cells(i, 33).Value = 0
Cells(i, 34).Value = "GL Incorrect"
See my attchment.
0
Comment
Question by:Justincut
[X]
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
  • 2
  • 2
4 Comments
 

Author Comment

by:Justincut
ID: 39732345
Here it is
Dummy-Rec-10.xlsm
0
 
LVL 35

Expert Comment

by:mvidas
ID: 39732378
Hi Justin,

Put the i=i+1 line just before the Wend line (at the end of the loop); it checks column E of a row, but then increases the row number before your code runs it.

Matt
0
 

Author Comment

by:Justincut
ID: 39732465
Hi Matt, do you mean after the  "End iF" statement?

Like this:


ElseIf Cells(i, 11).Value = "500000013" Then

Cells(i, 30).Value = "Manual Jnl - 1202566/dchet5 - CARFAX P&L CORRECTION"

Cells(i, 21).Value = "92,293.21"


Cells(i, 31).Value = "Manual Jnl (STD)"


Cells(i, 32).Value = "JC"
Cells(i, 33).Value = "0"
Cells(i, 34).Value = "0"

Cells(i, 36).Value = "14/03/2012"
End If
i = i + 1
Wend
0
 
LVL 35

Accepted Solution

by:
mvidas earned 500 total points
ID: 39732469
Yep, so that way when it runs through your loop it only interacts with the row it checked. At the end, it moves to the next row, and checks it then.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

726 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