Selecting cells in the column

topi1

Active Member
Joined
Aug 6, 2014
Messages
252
Office Version
  1. 2010
Hi, I am sharing a link to the table since Xl2bb gives me 1044-application-object... error.
In the column B of the sheet there are formula till row 14. Some cells are blank ("") and some show numbers. the last cell with the value is B10 although there are formulas in the B11-B14 cells.
I use the following formula to find the last nonblank cell in the column B even if there are blank cells before that.
=INDEX(B2:B140,AGGREGATE(14,6,(ROW(B2:B140)-ROW(B2)+1)/(B2:B140<>""),1))
Is it possible to use something like this and find a way to select a range from B2 to this last filled cell? Blank cells with formulas should not be included.
I tried to copy and paste values in another column and then try to select the range by selecting C2 and then Ctrl+End. But that selects C2-C14 range and not C2-C10
File is saved as .xlsm but I have no vba for this.

Any help will be appreciated. Thank you in advance.

 
No that is not a valid range in any code

You would need something like
VBA Code:
Range("B1:B" & Range("B" & Rows.count).End(xlUp).Row)
Ok. Thank you. I need to learn about range value. I can see that sometimes I could make use of similar thing as a formula than vba. I tried some before leaving for work and was getting #value error. TY.
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
You need to specify a number for both the start row and the end row unless dealing with the entire column in VBA
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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