select cell in a column matching text value of another cell

mdd16

Board Regular
Joined
Jan 11, 2011
Messages
84
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have a small code that's going into an endless loop... help to resolve will be highly appreciated .. screen shot of excel attached.

VBA Code:
Sub Fill_Xirr()

ActiveSheet.Range("IrrTab_Beg").Offset(1, 1).Select

Do While Not IsEmpty(ActiveCell) _
    Or Selection.Value <> Range("myTicker").Value
        Selection.Offset(1, 0).Select
Loop

F = Range("YrsInvested").Value
Selection.Offset(0, F).Value = Range("X_IRR").Value

End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Change Or to And.

Your logic is wrong. Your loop will continue any time either of these conditions is True
VBA Code:
Not IsEmpty(ActiveCell) Or Selection.Value <> Range("myTicker").Value
But one of these is guaranteed to be True for every cell. So it just keeps going.
 
Upvote 1
Solution

Forum statistics

Threads
1,224,597
Messages
6,179,813
Members
452,945
Latest member
Bib195

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top