[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

pick last item from a (variable) range

Gert

12/11/2006 3:39:00 PM

Hi all,

Is there a formula to pick the last item out of a (variable) range

thanks in advance
Gert

3 Answers

Jim Jackson

12/11/2006 4:36:00 PM

0

If the variable range always has a blank row beneath it, or the cell below in
Column A is empty:

Dim rng
With Cells
Set rng = .Range(.Cells(1,1),.Cells(1,1)).End (xldown)
rng.Select

This will select the last cell in Column A that has data.
*(1,1) refers to Row 1 and column 1

If column 20 will have data in the last row you can use (1,20),.(1,20)
instead of the above.

Of course, setting (rnumber,colnumber) according to your data's position.

--
Best wishes,

Jim


"Gert" wrote:

> Hi all,
>
> Is there a formula to pick the last item out of a (variable) range
>
> thanks in advance
> Gert
>
>

excel-ant

12/11/2006 6:08:00 PM

0

How do you mean pick

This piece of code will store and display the last cell in a selected
range(x)

Sub LastCell()

For Each cell In Selection
cell.Select: x = ActiveCell.Value
Next cell
MsgBox x

End Sub

http://www.excel...

jeff.j.griffith

12/11/2006 6:13:00 PM

0


Gert wrote:
> Hi all,
>
> Is there a formula to pick the last item out of a (variable) range
>
> thanks in advance
> Gert

How about this:

x(x.Rows.Count, x.Columns.Count).Value

where x is your range?