ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select the last Cell of a selected Cellarea (https://www.excelbanter.com/excel-programming/332406-select-last-cell-selected-cellarea.html)

Ben

Select the last Cell of a selected Cellarea
 
Hallo,

if there are the following value in a column
23
21
32
Sum

and I select with the mouse the area with first three rows (only the
numerical values). Which command can I use to determine the rangeadress in a
macro?

The Command determine the whole range, including the string in the last
line. This is not that I need.
..Range(ActiveCell.Address(0, 0) & ":a" & .Cells(Rows.Count,
"A").End(xlUp).Row)

Thanks,
Ben

Tom Ogilvy

Select the last Cell of a selected Cellarea
 
..Range(ActiveCell.Address(0, 0) & ":a" & .Cells(Rows.Count,
"A").End(xlUp).Row-1)


--
Regards,
Tom Ogilvy


"Ben" wrote in message
...
Hallo,

if there are the following value in a column
23
21
32
Sum

and I select with the mouse the area with first three rows (only the
numerical values). Which command can I use to determine the rangeadress in

a
macro?

The Command determine the whole range, including the string in the last
line. This is not that I need.
.Range(ActiveCell.Address(0, 0) & ":a" & .Cells(Rows.Count,
"A").End(xlUp).Row)

Thanks,
Ben




Ben

Select the last Cell of a selected Cellarea
 
This is not, that I need. Thats why I don't know if where one, two or five
.... lines at the buttom of the numerical values. The user marked the
numerical values and I need to know the range, that is marked. With the
command

..Range(ActiveCell.Address(0, 0) & ":a" & .Cells(Rows.Count,
"A").End(xlUp).Row)

I get all cells to the next empty cell in the column but not only the
user-marked.

Thanks,
Ben

"Tom Ogilvy" schrieb:

..Range(ActiveCell.Address(0, 0) & ":a" & .Cells(Rows.Count,
"A").End(xlUp).Row-1)


--
Regards,
Tom Ogilvy


"Ben" wrote in message
...
Hallo,

if there are the following value in a column
23
21
32
Sum

and I select with the mouse the area with first three rows (only the
numerical values). Which command can I use to determine the rangeadress in

a
macro?

The Command determine the whole range, including the string in the last
line. This is not that I need.
.Range(ActiveCell.Address(0, 0) & ":a" & .Cells(Rows.Count,
"A").End(xlUp).Row)

Thanks,
Ben





Ben

Select the last Cell of a selected Cellarea
 
Activewindow.RangeSelection

Sorry. Thats it,
Ben

"Ben" schrieb:

This is not, that I need. Thats why I don't know if where one, two or five
... lines at the buttom of the numerical values. The user marked the
numerical values and I need to know the range, that is marked. With the
command

.Range(ActiveCell.Address(0, 0) & ":a" & .Cells(Rows.Count,
"A").End(xlUp).Row)

I get all cells to the next empty cell in the column but not only the
user-marked.

Thanks,
Ben

"Tom Ogilvy" schrieb:

..Range(ActiveCell.Address(0, 0) & ":a" & .Cells(Rows.Count,
"A").End(xlUp).Row-1)


--
Regards,
Tom Ogilvy


"Ben" wrote in message
...
Hallo,

if there are the following value in a column
23
21
32
Sum

and I select with the mouse the area with first three rows (only the
numerical values). Which command can I use to determine the rangeadress in

a
macro?

The Command determine the whole range, including the string in the last
line. This is not that I need.
.Range(ActiveCell.Address(0, 0) & ":a" & .Cells(Rows.Count,
"A").End(xlUp).Row)

Thanks,
Ben





Tom Ogilvy

Select the last Cell of a selected Cellarea
 
Or just selection in the scenario you describe.



--
Regards,
Tom Ogilvy


"Ben" wrote in message
...
Activewindow.RangeSelection

Sorry. Thats it,
Ben

"Ben" schrieb:

This is not, that I need. Thats why I don't know if where one, two or

five
... lines at the buttom of the numerical values. The user marked the
numerical values and I need to know the range, that is marked. With the
command

.Range(ActiveCell.Address(0, 0) & ":a" & .Cells(Rows.Count,
"A").End(xlUp).Row)

I get all cells to the next empty cell in the column but not only the
user-marked.

Thanks,
Ben

"Tom Ogilvy" schrieb:

..Range(ActiveCell.Address(0, 0) & ":a" & .Cells(Rows.Count,
"A").End(xlUp).Row-1)


--
Regards,
Tom Ogilvy


"Ben" wrote in message
...
Hallo,

if there are the following value in a column
23
21
32
Sum

and I select with the mouse the area with first three rows (only the
numerical values). Which command can I use to determine the

rangeadress in
a
macro?

The Command determine the whole range, including the string in the

last
line. This is not that I need.
.Range(ActiveCell.Address(0, 0) & ":a" & .Cells(Rows.Count,
"A").End(xlUp).Row)

Thanks,
Ben







All times are GMT +1. The time now is 11:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com