KnutsonBM
asked on
VBA Code to find name and populate cell
Using xl2007
What I am looking for the code to do:
(i) would be the row number as we loop through
If the Cell in Column E, Row (i) = "RB"
then find the first cell ABOVE it in Column E that Says "C".
The value from column D on the Row containing C needs to go into Column I on row (i)
The value from Column F on the Row containing C needs to go into Column J row (i)
If the Cell in Column E, Row (i) does not equal "RB" then move on to the next row
Any assistance is greatly appreciated!
Thanks, Brandon
What I am looking for the code to do:
(i) would be the row number as we loop through
If the Cell in Column E, Row (i) = "RB"
then find the first cell ABOVE it in Column E that Says "C".
The value from column D on the Row containing C needs to go into Column I on row (i)
The value from Column F on the Row containing C needs to go into Column J row (i)
If the Cell in Column E, Row (i) does not equal "RB" then move on to the next row
Any assistance is greatly appreciated!
Thanks, Brandon
ASKER
no, no functions, just some simple vba code to loop through the dataset and populate Columns I and J
ASKER
DOH, i figured it out, sorry to bother yall:
Sub FindResp()
Dim Z As Integer
Dim i As Integer
i = 2
Do Until Cells(i, "A").Value = ""
If Cells(i, "E").Value = "ROUTE BACK" Then
Z = i
Do Until Cells(Z, "E").Value = "COMPLETE"
Z = Z - 1
Loop
Cells(i, "I").Value = Cells(Z, "D").Value
Cells(i, "J").Value = Cells(Z, "F").Value
Else
End If
i = i + 1
Loop
End Sub
if anybody has suggestions for better coding i would gladly take them.........
-Brandon
Sub FindResp()
Dim Z As Integer
Dim i As Integer
i = 2
Do Until Cells(i, "A").Value = ""
If Cells(i, "E").Value = "ROUTE BACK" Then
Z = i
Do Until Cells(Z, "E").Value = "COMPLETE"
Z = Z - 1
Loop
Cells(i, "I").Value = Cells(Z, "D").Value
Cells(i, "J").Value = Cells(Z, "F").Value
Else
End If
i = i + 1
Loop
End Sub
if anybody has suggestions for better coding i would gladly take them.........
-Brandon
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
~bp