Selecting the Last Row of a Column

zaska

Well-known Member
Joined
Oct 24, 2010
Messages
1,046
I want to select the last Row of Column A where the data " CORRECT " ENDS.


Column A

POWER
POWER
CORRECT
CORRECT
CORRECT
CORRECT
CORRECT
CORRECT
INCORRECT
INCORRECT

I want to select the last row number of Correct

At present i am manually Selecting it

Code:
Rows("686:686").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.ClearContents


<table width="64" border="0" cellpadding="0" cellspacing="0"><col width="64"><tr height="17"> <td style="height:12.75pt;width:48pt" width="64" height="17">

</td> </tr></table>
 

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)
Try:

Code:
Range("A:A").Find("Correct", LookIn:=xlValues, LookAt:=xlWhole, SearchDirection:=xlPrevious).Select
 
Upvote 0
Thanks..

What would be the Code..If i want to delete all the Rows after the Cell Value " Correct "

I want to delete Data after "Correct" in range " A:O"
 
Upvote 0
If I understood your request properly, try:

Code:
Public Sub DelAfterCorrect()
Dim rng As Range, _
    LR  As Long
Set rng = Range("A:A").Find("Correct", LookIn:=xlValues, Lookat:=xlWhole, SearchDirection:=xlPrevious)
If Not rng Is Nothing Then
    LR = Range("A" & rows.Count).End(xlUp).Row
    Range(rng.Offset(1, 0), Cells(LR, "O")).ClearContents
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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