Solved

Do Loop not working

Posted on 2013-12-17
5
105 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Search for a value in Column? 5 21
Highlighting cells in Excel 9 17
How do I crate a Pivot table in Excel 2 10
nested if statement in excel help 4 15
Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

895 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

11 Experts available now in Live!

Get 1:1 Help Now