ActiveCell two rows below last word in a column

mlarson

Well-known Member
Joined
Aug 25, 2011
Messages
509
Office Version
  1. 2010
Platform
  1. Windows
Hi all, hoping you can help me with this.

I would like a code to make the active cell 2 rows below the final word in a column. (Or, if it's less rigorous on Excel, the final word in my spreadsheets will always be "next" - so please use that if it doesn't take as much power/processing to accomplish the same thing).

So, for example, if there are words in cells A5, A8, A12, and A17 (and no words after that), I would like the active cell to be A19.

Note: there may be numbers in cells in the column, but I want this to ignore those and only find the cell that is 2 spots beneath the final word.

Thanks in advance for your help!
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
VBA Code:
Sub ActivateCellsBelowLastTextValueInColumnA()
    Dim lastRow As Long
    lastRow = Cells(Rows.Count, "A").End(xlUp).Row

    Dim i As Long
    For i = lastRow To 1 Step -1
        If Not IsNumeric(Cells(i, "A").Value) And Cells(i, "A").Value <> "" Then
            Cells(i + 2, "A").Activate
            Exit For
        End If
    Next i
End Sub
 
Upvote 0
Solution
Also, if I wanted the active cell to be in column C instead of column A, how would I edit that code?

So, the active cell would be, in reference to the last word in column A, still two rows down but now also two columns to the right.

If this follow-up question should be posted in an entirely new thread, please let me know.

Thanks!
 
Upvote 0
Try changing this
VBA Code:
Cells(i + 2, "A").Activate
To this
VBA Code:
Cells(i + 2, "C").Activate
 
Upvote 0
Thank you, that works, too! Appreciate your help.
 
Upvote 0

Forum statistics

Threads
1,215,025
Messages
6,122,734
Members
449,094
Latest member
dsharae57

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