Solved

dO LOOP PROBLEM

Posted on 2013-12-20
4
214 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
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 Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

762 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