Selecting data from column and stop at the last column with data

SteynBS

Board Regular
Joined
Jun 27, 2022
Messages
104
Office Version
  1. 365
Platform
  1. Windows
Hi guys,

I have this vba code

Range("A1:B" & Range("A" & Rows.Count).End(xlUp).Row).Select it selects data in column A and B but stops at the last row with data in Column A.

Now I need something that does it for rows.

Let's say selecting data in Column A from row 2 (may change) up until the last column with data in it and the last row with data

Any help will be appreciated
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
You will need to loop through each column to determine last row for both and then use the lowest row as "lastrow". I will post a sample shortly.
 
Upvote 0
Hi guys,

I have this vba code

Range("A1:B" & Range("A" & Rows.Count).End(xlUp).Row).Select it selects data in column A and B but stops at the last row with data in Column A.

Now I need something that does it for rows.

Let's say selecting data in Column A from row 2 (may change) up until the last column with data in it and the last row with data

Any help will be appreciated
I thought I read your post correctly but re-read it and not sure exactly what you mean. Can you expand a little please?
 
Upvote 0
Does this do what you want
VBA Code:
ActiveSheet.UsedRange.Select
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,666
Members
449,091
Latest member
peppernaut

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