How to select range from ActiveCell to cell 1058476 in the same column.

Ingemar

New Member
Joined
May 8, 2017
Messages
23
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am trying by VBA code to sekect a range from the active cell to the very last cell in the same column (on row 1048576) regardless if it is empty or not. I have tried the code below without sucess.

Range(ActiveCell, ActiveColumn & 1048576).Select

Greatful for any suggestion.

Ingemar
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
How about
VBA Code:
ActiveCell.Resize(Rows.Count - ActiveCell.Row + 1).Select
 
Upvote 0
VBA Code:
Range(ActiveCell, Cells(1048576, ActiveCell.Column)).Select
or
VBA Code:
Range(ActiveCell, Cells(Rows.Count, ActiveCell.Column)).Select
 
Upvote 0
Hello Fluff and Mark858! :)

I see no difference in the functionality of your three suggestions. All codes work great.

THANK YOU for the help.

Kind regards

Ingemar
 
Upvote 0
From experience Resize uses more resources than referring directly to the range and so has an effect if you are dealing with a lot of large ranges. It won't make any difference what code you use with what you are doing.

The use of 1048576 in the first code I posted means that it won't be backwards compatible with anyone using below Excel 2007 so it will error if you ran it on a computer running 2003 for example.
Both the other codes using Rows.Count are backwards compatible.
 
Upvote 0

Forum statistics

Threads
1,215,330
Messages
6,124,305
Members
449,150
Latest member
NyDarR

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