How to select the full last column of the last row in VBA?

Bassie

Board Regular
Joined
Jan 13, 2022
Messages
66
Office Version
  1. 2019
Platform
  1. Windows
Hey,

So I know how to select last rows and last columns seperatly but I cant figure out for the life of me how to combine the two. I am trying to first find the last column and then use the & Rows.Count).End(xlUP)) to find the last row aswell and exlude the header aswell if possible.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
VBA Code:
lr = Cells(Rows.Count, Cells(7, Columns.Count).End(xlToLeft).Column).End(xlUp).Row
 
Upvote 0
VBA Code:
lr = Cells(Rows.Count, Cells(7, Columns.Count).End(xlToLeft).Column).End(xlUp).Row
Thank you! I am a bit new to VBA and it seems that it works but how do I select these cells now?
 
Upvote 0
VBA Code:
lc = Cells(7, Columns.Count).End(xlToLeft).Column
lr = Cells(Rows.Count, Cells(7, Columns.Count).End(xlToLeft).Column).End(xlUp).Row

Cells(lr, lc).Select
 
Upvote 0
Solution

Forum statistics

Threads
1,216,375
Messages
6,130,245
Members
449,568
Latest member
mwl_y

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