looping and stopping cont

A

april

sorry that the previous post was truncated. i had composed a whole
explanation of the problem only to have the system go down on me. wanted to
make sure that it was working before i began the explantion again.

i have a macro that does the following.
1. goes to a cell in Col T (which contains the name of a project)
2. evaulates the contents, if the cell = General Research
3. go 16 columns to the left and put in MIT0001 (16 col to left is for the
donor's name)
4. go to the next row

as you can see by my macro, there are other projects than General research
and other donors than MIT.

THIS IS WHAT I WANT THE MACRO TO ALSO DO
1. Put the amount of funding by a donor in a cell - say AE1 for Donor X,
AF1 for Donor Y, etc
2. The expense amounts for the project are in Col Z
3. keep a running total of Col Z that are associated with the donor's name
in the donor name col
4. when the expenses> than the amount in cell AE1, put in the next donor
(if there is one)
4. if have no other donor for this project, put in UNRESTR

i am including the part of the macro that works. any help or suggestions
that you can make would be really appreciated.

thanks in advance
Sub loopthroughnamesonly()
Dim C As Range
Dim D As Range
Dim MyRange As Range
Dim myRow As Integer
myRow = 618
Set MyRange = Range("T618:T1387")
For Each C In MyRange
If C.Value = "Karlan General Research" Then
C.Offset(0, 16).Value = "WBK0000"
ElseIf C.Value = "Karlan-Gine" Then
C.Offset(0, 16).Value = "WBK0000"
ElseIf C.Value = "MIT-JPAL:Udaipur Health" Then
C.Offset(0, 16).Value = "MIT0000"
ElseIf C.Value = "MIT-JPAL:pratham Information" Then
C.Offset(0, 16).Value = "NBE0001"
ElseIf C.Value = "MIT-JPAL:Udaipur Health" Then
C.Offset(0, 16).Value = "NBE0001"
ElseIf C.Value = "Project Grad" Then
C.Offset(0, 16).Value = "PRJ0001"
ElseIf C.Value = "PRISMA - Trust" Then
C.Offset(0, 16).Value = "WES0001"

End If

ActiveCell.Offset(1, 0).Select
myRow = myRow + 1
Next
'Next
End Sub
 
D

Don Guillett

You don't need the row= or the row+1 or ANY selections the for/each will
suffice. I would use a select case instead. You said to the LEFT but your
offset is going to the right.
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top