Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default How do i select the coordinates of the first column & last row in a pasted range

When i have a range pasted to a worksheet, how do i retrieve the coordinates of the last row, first column of this range (the range contains empty cells).

Example of a range : B3:F32 = the result shuld be B32

The range is not fixed, it could contain 1 row to ..... rows
PS : The range is pasted and selected


Thanx for your help.

Luc
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How do i select the coordinates of the first column & last row ina pasted range

On 15 dic, 19:42, "Luc" wrote:
When i have a range pasted to a worksheet, how do i retrieve the coordinates of the last row, first column of this range (the range contains empty cells).

Example of a range : B3:F32 *= the result shuld be B32

The range is not fixed, it could contain 1 row to ..... rows
PS : The range is pasted and selected

Thanx for your help.

Luc


Hello.

One way is:

Sub lastrowfirstcolumn()
With Selection
first_column = .Column
last_row = .Row + .Rows.Count - 1
coord = Cells(last_row, first_column).Address
End With
End Sub

Regards,

Benito
Barcelona
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default How do i select the coordinates of the first column & last row in a pasted range

You can get the address with this one-liner....

LastRowFirstColAddress = Selection(1)(Selection.Rows.Count).Address(0, 0)

--
Rick (MVP - Excel)


"Luc" wrote in message ...
When i have a range pasted to a worksheet, how do i retrieve the coordinates of the last row, first column of this range (the range contains empty cells).

Example of a range : B3:F32 = the result shuld be B32

The range is not fixed, it could contain 1 row to ..... rows
PS : The range is pasted and selected


Thanx for your help.

Luc
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default How do i select the coordinates of the first column & last row in a pasted range

Thanx Benito,

What code should i use to move to this last cell + 1 row lower ?
And make this the active cell.

In my Example that would be B32 + 1 row = B33






"Benito Merino" schreef in bericht
...
On 15 dic, 19:42, "Luc" wrote:
When i have a range pasted to a worksheet, how do i retrieve the
coordinates of the last row, first column of this range (the range
contains empty cells).

Example of a range : B3:F32 = the result shuld be B32

The range is not fixed, it could contain 1 row to ..... rows
PS : The range is pasted and selected

Thanx for your help.

Luc


Hello.

One way is:

Sub lastrowfirstcolumn()
With Selection
first_column = .Column
last_row = .Row + .Rows.Count - 1
coord = Cells(last_row, first_column).Address
End With
End Sub

Regards,

Benito
Barcelona

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default How do i select the coordinates of the first column & last row in a pasted range

And if you want to select that cell, just do this...

Selection(1)(Selection.Rows.Count).Select


--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message ...
You can get the address with this one-liner....

LastRowFirstColAddress = Selection(1)(Selection.Rows.Count).Address(0, 0)

--
Rick (MVP - Excel)


"Luc" wrote in message ...
When i have a range pasted to a worksheet, how do i retrieve the coordinates of the last row, first column of this range (the range contains empty cells).

Example of a range : B3:F32 = the result shuld be B32

The range is not fixed, it could contain 1 row to ..... rows
PS : The range is pasted and selected


Thanx for your help.

Luc


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default How do i select the coordinates of the first column & last row in a pasted range

Perfect , thanxxxxs for all the help.
If i hadn't you guys.......


Luc
"Rick Rothstein" schreef in bericht ...
And if you want to select that cell, just do this...

Selection(1)(Selection.Rows.Count).Select


--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message ...
You can get the address with this one-liner....

LastRowFirstColAddress = Selection(1)(Selection.Rows.Count).Address(0, 0)

--
Rick (MVP - Excel)


"Luc" wrote in message ...
When i have a range pasted to a worksheet, how do i retrieve the coordinates of the last row, first column of this range (the range contains empty cells).

Example of a range : B3:F32 = the result shuld be B32

The range is not fixed, it could contain 1 row to ..... rows
PS : The range is pasted and selected


Thanx for your help.

Luc
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Worksheet Where Data is Pasted sgltaylor Excel Programming 1 December 14th 09 06:22 AM
select a range in a column jimbo Excel Discussion (Misc queries) 4 December 10th 09 11:46 AM
Select range between column and row Robert H Excel Programming 3 December 29th 08 11:47 PM
Select column same row by range name Kevryl Excel Programming 1 August 1st 06 07:16 AM
select date range in column garlocd Excel Worksheet Functions 2 July 11th 06 06:23 AM


All times are GMT +1. The time now is 02:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"