Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

dO LOOP PROBLEM

Posted on 2013-12-20
4
Medium Priority
?
265 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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

610 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