Find and Select the Last Row and Column

Ulisses_Carso

New Member
Joined
Sep 4, 2020
Messages
39
Office Version
  1. 365
Platform
  1. Windows
Hello Guys,

I'm trying to make select code tha finds the Last Row, then find and jump to the Last Column in the same Line and select that Cell

Example: i have 10 columns with 40 lines
Line A with Header, Column A with Data and the rest is blank

This way, the last cell is J40, but i don't know how to find and select that cell, I already tried to merge two codes that find the last row and column separately but no success.

VBA Code:
Sub FindLastRow()
    Dim LastRow As Long
    With ActiveSheet
        LastRow = .Cells(.Rows.Count, "A").End(xlUp).Select
    End With
End Sub

Sub FIndLasCol()
    Dim LastCol As Integer
    With ActiveSheet
        LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Select
    End With
End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
How about
VBA Code:
Sub UlissesCarso()
   Cells(Range("A" & Rows.Count).End(xlUp).Row, Columns.Count).End(xlToLeft).Select
End Sub
 
Upvote 0
it worked well, but this way it selects the last row and/or last filled column, there is a chance that the last cell is blank.
Assuming that in my example cell J40 is blank, I need to select it anyway because after selecting ths cell i'll expand selection to "E2"
 
Upvote 0
Ok, how about
VBA Code:
Sub UlissesCarso()
   With Range("a1").CurrentRegion
      Cells(.Rows.Count, .Columns.Count).Select
   End With
End Sub
 
Upvote 0
Solution
Thanks dude, now it worked perfectly
i'm feeling a little dumb, this code is so simple, kkk
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,895
Messages
6,122,128
Members
449,066
Latest member
Andyg666

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