Slightly embarrassed

Hendrixx

New Member
Joined
Nov 14, 2017
Messages
17
Hi all,

I'm slightly embarrassed to be asking this, as I feel it should be simple.

I have no experience with programming or VBA, but I can usually find something similar to what I want online, and then make changes or adjustments to get it to do what I need. I'm struggling to find something similar to this....likely because it IS so simple...but I can't work it out.

I have a series of numbers in Column O, sorted high to low, and I want to go tothe first cell in the column with a number less than 1000, after which I am good with the rest of the routine.

I have tried many different variations and versions...this is where I have got to so far....although, as any of you who can read this stuff will realise, it doesn't work - it simply selects the last (non-blank) row of Column O.

What am I doing wrong please?

VBA Code:
Sub DeleteBelow1K()

last_row = ActiveSheet.UsedRange.Rows.Count

For i = 1 To last_row
            
        If i < 1000 Then
        
        Cells(i, "O").Select
    End If
Next i


End Sub
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try
VBA Code:
If Cells(i, "O") < 1000 Then
    Cells(i,"O").Select
    Exit For
End If
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,730
Members
448,987
Latest member
marion_davis

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