Solved

Do Loop not working

Posted on 2013-12-17
5
119 Views
Last Modified: 2013-12-19
Hi Guys, can anyone tell me why this piece of my code is not working ?

ElseIf Cells(i, 6).Value = "LDCFICOT1A" Then
Cells(i, 25).Value = "8631"
Cells(i, 30).Value = "Bond Pricing diff btw MX and GBO"


Cells(i, 31).Value = "IT Rec Issue - FO MTM on Bonds (MTM folder)"



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


Cells(i, 33).Value = "0"
Cells(i, 36).Value = "05/09/2011"
DummyRec8.xlsx
0
Comment
Question by:Justincut
  • 3
  • 2
5 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 39723574
Not working in what sense? (there isn't any code in that file)
0
 

Author Comment

by:Justincut
ID: 39723840
For some reason, its not populating those Cells. Here's the attachment with Macro.
DummyRec8.xlsm
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 39723881
It's because the only row that matches that criterion also matches one of your previous If statements:
ElseIf Cells(i, 8).Value = "-3848015, -5132700, -4986040, -6783900, -6881113, -6764890, -6881026, -3862199, -3847999, -4984470" Then

so the line that populates the other cells is never executed.
0
 

Author Comment

by:Justincut
ID: 39725135
Cool! Can you tell me how you found out? Did you use the immediate window?
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 39725476
I used a debug.assert to break the code when i hit the row number of interest, then stepped through to see what was being executed.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

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 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.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

829 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