I want the following code to stop at row 3000. Where can I insert the code and what should it be?
I am looping through data in column 1 until I find TRANSACTION SUMMARY. Then I pass a specified value through to a variable and post to column 17 as long as column 1 is not ABC. Once column 1 is ABC, it exits the do and starts over with the first do loop, I want the code to find the next TRANSACTION SUMMARY and so on. All that works just fine. I can't figure out how to stop this. Also, I admit this code isn't very pretty...I am a beginner. Thank you.
I am looping through data in column 1 until I find TRANSACTION SUMMARY. Then I pass a specified value through to a variable and post to column 17 as long as column 1 is not ABC. Once column 1 is ABC, it exits the do and starts over with the first do loop, I want the code to find the next TRANSACTION SUMMARY and so on. All that works just fine. I can't figure out how to stop this. Also, I admit this code isn't very pretty...I am a beginner. Thank you.
Code:
Sub UpdateFundName()
StartRow = 1
TranCodeCol = 1
FundColumn = 17
EndRow = 1
CurrentCell = Cells(StartRow, TranCodeCol)
Do Until CurrentCell = "TRANSACTION SUMMARY "
CurrentCell = Cells(StartRow, TranCodeCol)
If CurrentCell = "TRANSACTION SUMMARY " Then
StartRow = StartRow + 1
Fund = Cells(StartRow, TranCodeCol)
StartRow = StartRow + 10
Do
CurrentCell = Cells(StartRow, TranCodeCol)
If CurrentCell = "ABC" Then Exit Do
CurrentCell = Cells(StartRow, TranCodeCol)
Cells(StartRow, FundColumn).Value = Fund
StartRow = StartRow + 1
CurrentCell = Cells(StartRow, TranCodeCol)
If CurrentCell = "ABC" Then Exit Do
Loop
End If
StartRow = StartRow + 1
Loop
End Sub
Last edited by a moderator: