Slightly embarrassed

Hendrixx

New Member
Joined
Nov 14, 2017
Messages
13
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
 

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,517
Office Version
  1. 365
Platform
  1. Windows
Try
VBA Code:
If Cells(i, "O") < 1000 Then
    Cells(i,"O").Select
    Exit For
End If
 
Solution

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,517
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,505
Messages
5,625,199
Members
416,080
Latest member
blemon

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
Top