VBA identify first time an account is above 2999999

jakobt

Active Member
Joined
May 31, 2010
Messages
337
Do have an increasing list of numbers (account numbers) in column B.

I want to write a variable to identify the row number on the account first time the listed account number is above 2999999.

The variable can be called "Marginrow".
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
.
Here is a formula approach.

Considering you are using Sheet2. In cell D1 enter this formula :

Code:
=IFERROR(MATCH(C1,Sheet2!B:B,0),"Enter Amt")



Enter the amount you are seeking in C1, the row number will display in D1.

If C1 is left blank, D1 will display "Enter Amt"
 
Upvote 0
.
Here is a VBA macro approach :

Code:
Option Explicit


Sub FindFirstMatchColumnA()
     
    Dim SearchString As String
    Dim FoundCell As Range
     
    SearchString = InputBox("string to find here")
     
    With Sheets("Sheet1").Range("B:B") 'change Sheet1 to suit
        Set FoundCell = .Cells.Find(What:=SearchString, _
        After:=.Cells(.Cells.Count), _
        LookIn:=xlValues, _
        LookAt:=xlWhole, _
        SearchOrder:=xlByRows, _
        SearchDirection:=xlNext, _
        MatchCase:=False)
         
        If Not FoundCell Is Nothing Then
        MsgBox FoundCell.Address
        FoundCell.Select
        Else
            MsgBox "Search String not found"
        End If
    End With
     
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,042
Messages
6,122,810
Members
449,095
Latest member
m_smith_solihull

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