Search row of data for numbers not negative or in parenthesis

ThomasOES

Board Regular
Joined
Aug 29, 2017
Messages
174
I need vba to search down a column from cell D1 to the end of the data. The length of the column of data varies. I need the first cell that is non-negative and no parenthesis.
Below is a sample column. I need to start the search with the cell below C and then select the cell with 0.026.

C
-3
-3
-3
-2
-2
(0.023)
0.026
0.0367
0.04
0.05
0.051
0.052
0.055
0.106

Thanks

Tom

<tbody>
</tbody>
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Assuming that your parentheses represent negative numbers, then you could use a simple loop to do it, like this:
Code:
Sub FirstPositive()

    Dim myRow As Long
    
    myRow = 1
    Do
        If Cells(myRow, "D") > 0 Then Exit Do
        myRow = myRow + 1
    Loop
    Cells(myRow, "D").Select
    
End Sub
 
Upvote 0
Thanks Joe
Your code works. Sorry about the extra submission. I wasn't sure my question made sense.

Tom
 
Upvote 0
You are welcome.

If you are ever unsure if it is clear, you can post clarifications back to the original post. I would just wait a little while, as posting back to it removes it from the "Zero Reply Posts" listing that many of us use to look for unanswered questions.
 
Upvote 0

Forum statistics

Threads
1,216,109
Messages
6,128,876
Members
449,476
Latest member
pranjal9

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