#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Last Cell

Hi Everybody,

Does anyone know a way to select the last used cell in a column by using
macro? For example, there is a range filled with data from "A1" to "A30", but
the closing cell is always changing (A32,A36...). I would like to find the
last data in column "A" by using VLOOKUP automatically.

Thank you in advance for your help,

sisco98
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Last Cell


LastCell = Cells(Rows.Count,"A").End(xlUp)

--
HTH

Bob Phillips

"sisco98" wrote in message
...
Hi Everybody,

Does anyone know a way to select the last used cell in a column by using
macro? For example, there is a range filled with data from "A1" to "A30",

but
the closing cell is always changing (A32,A36...). I would like to find the
last data in column "A" by using VLOOKUP automatically.

Thank you in advance for your help,

sisco98



  #3   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default Last Cell

Hi sisco98,

You can try one of these:

1)
Sub Test1()
Cells(Rows.Count, "A").End(xlUp).Select
End Sub

2)
Sub Test2()
Range("A:A").Find("*", Cells(1), _
xlValues, xlWhole, xlByRows, xlPrevious).Select
End Sub

Regards,
KL


"sisco98" wrote in message
...
Hi Everybody,

Does anyone know a way to select the last used cell in a column by using
macro? For example, there is a range filled with data from "A1" to "A30",
but
the closing cell is always changing (A32,A36...). I would like to find the
last data in column "A" by using VLOOKUP automatically.

Thank you in advance for your help,

sisco98



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Last Cell

Use:
range("A65536").End(xlUp).select to select the row
range("A65536").End(xlUp).row for the row number
range("A65536").End(xlUp).address for the cell address

Mangesh



"sisco98" wrote in message
...
Hi Everybody,

Does anyone know a way to select the last used cell in a column by using
macro? For example, there is a range filled with data from "A1" to "A30",

but
the closing cell is always changing (A32,A36...). I would like to find the
last data in column "A" by using VLOOKUP automatically.

Thank you in advance for your help,

sisco98



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Last Cell


You will find the last used cell by looking up the first used cell fro
the bottom, so the last used cell in column A would be

myValue = Activesheet.Columns(1).Cells(65536).End(xlUp).Valu e

Regards,
Ton Teun

--
Ton
-----------------------------------------------------------------------
TonT's Profile: http://www.officehelp.in/member.php?userid=4
View this thread: http://www.officehelp.in/showthread.php?t=65563
Visit - http://www.officehelp.in/archive/index.php | http://www.officehelp.in/index/index.ph



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Last Cell

Hi TonT,

Thank you for your fast help!

Kind regards


--
sisco98


"TonT" wrote:


You will find the last used cell by looking up the first used cell from
the bottom, so the last used cell in column A would be

myValue = Activesheet.Columns(1).Cells(65536).End(xlUp).Valu e

Regards,
Ton Teuns


--
TonT
------------------------------------------------------------------------
TonT's Profile: http://www.officehelp.in/member.php?userid=47
View this thread: http://www.officehelp.in/showthread.php?t=655633
Visit - http://www.officehelp.in/archive/index.php | http://www.officehelp.in/index/index.php


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Last Cell

Hi Mangesh,

thanks for your help!

Regards
--
sisco98


"Mangesh Yadav" wrote:

Use:
range("A65536").End(xlUp).select to select the row
range("A65536").End(xlUp).row for the row number
range("A65536").End(xlUp).address for the cell address

Mangesh



"sisco98" wrote in message
...
Hi Everybody,

Does anyone know a way to select the last used cell in a column by using
macro? For example, there is a range filled with data from "A1" to "A30",

but
the closing cell is always changing (A32,A36...). I would like to find the
last data in column "A" by using VLOOKUP automatically.

Thank you in advance for your help,

sisco98




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Last Cell

Hi Bob,

Thank you for your help,

regards
--
sisco98


"Bob Phillips" wrote:


LastCell = Cells(Rows.Count,"A").End(xlUp)

--
HTH

Bob Phillips

"sisco98" wrote in message
...
Hi Everybody,

Does anyone know a way to select the last used cell in a column by using
macro? For example, there is a range filled with data from "A1" to "A30",

but
the closing cell is always changing (A32,A36...). I would like to find the
last data in column "A" by using VLOOKUP automatically.

Thank you in advance for your help,

sisco98




  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Last Cell

Hello KL,

thanks for quick help!

regards
--
sisco98


"KL" wrote:

Hi sisco98,

You can try one of these:

1)
Sub Test1()
Cells(Rows.Count, "A").End(xlUp).Select
End Sub

2)
Sub Test2()
Range("A:A").Find("*", Cells(1), _
xlValues, xlWhole, xlByRows, xlPrevious).Select
End Sub

Regards,
KL


"sisco98" wrote in message
...
Hi Everybody,

Does anyone know a way to select the last used cell in a column by using
macro? For example, there is a range filled with data from "A1" to "A30",
but
the closing cell is always changing (A32,A36...). I would like to find the
last data in column "A" by using VLOOKUP automatically.

Thank you in advance for your help,

sisco98




  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default Last Cell

Some of the replies have 65536 as the maximum number of rows in an
Excel worksheet. The number of rows has varied in the past and could
change again. so it would be better to use Rows.Count as in the other
replies. You might find it more useful with a toolbar button see
http://www.mvps.org/dmcritchie/excel...ars.htm#macros
the macro GotoBottomofCurrentColumn and you can use the button icon shown at the
far right. of the macro.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"sisco98" wrote in message ...
Hi Everybody,

Does anyone know a way to select the last used cell in a column by using
macro? For example, there is a range filled with data from "A1" to "A30", but
the closing cell is always changing (A32,A36...). I would like to find the
last data in column "A" by using VLOOKUP automatically.

Thank you in advance for your help,

sisco98



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
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Excel Discussion (Misc queries) 0 June 29th 09 11:20 AM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Yuvraj Excel Discussion (Misc queries) 0 June 26th 09 06:01 PM
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 [email protected] Excel Worksheet Functions 1 August 22nd 08 02:04 AM
How to create/run "cell A equals Cell B put Cell C info in Cell D abmb161 Excel Discussion (Misc queries) 5 January 26th 06 06:36 PM
data validation to restrict input in cell based on value of cell above that cell NC Excel Programming 2 January 25th 05 07:11 AM


All times are GMT +1. The time now is 04:05 PM.

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

About Us

"It's about Microsoft Excel"