Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default a macro which finds last cell in a column

please tell me the macro which can find last cell in a column

thank u so muc

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default a macro which finds last cell in a column

x = the number of the column you are concerned with (column "A" = 1
column "B" = 2 etc.)

last = Worksheets("Sheet1").UsedRange.Row - 1
Worksheets("Sheet1").UsedRange.Rows.Count
Do Until Worksheets("Sheet1").Cells(last, x).Value < ""
last = last - 1
Loo

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default a macro which finds last cell in a column

Dim rng as Range colNum as Long
colNum = 1
set rng = cells(rows.count,colNum).End(xlup)

--
Regards,
Tom Ogilvy

"vikram " wrote in message
...
please tell me the macro which can find last cell in a column

thank u so much


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default a macro which finds last cell in a column

Excel down assumes contiguous data (no empty cells). xlup doesn't.

--
Regards,
Tom Ogilvy

<question for you; "Ron" wrote in
message ...
Is there a reason why you prefer to use choose
.End(xlup) vs .End(xldown)


----- Tom Ogilvy wrote: -----

Dim rng as Range colNum as Long
colNum = 1
set rng = cells(rows.count,colNum).End(xlup)

--
Regards,
Tom Ogilvy

"vikram " wrote in message
...
please tell me the macro which can find last cell in a column
thank u so much
---

Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default a macro which finds last cell in a column

Note - not typical, but for example (column A):

if the only not empty cell in column A is A65536 (the last row of th
sheet), then xlUp selects the cell A1 (the first row of the sheet)

Jare

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default a macro which finds last cell in a column

No one said you shouldn't test your results.

--
Regards,
Tom Ogilvy

"Jarek " wrote in message
...
Note - not typical, but for example (column A):

if the only not empty cell in column A is A65536 (the last row of the
sheet), then xlUp selects the cell A1 (the first row of the sheet)

Jarek


---
Message posted from http://www.ExcelForum.com/



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
Identify which column 'Large' finds a match in ker_01 Excel Worksheet Functions 6 April 14th 09 06:07 PM
MACRO which deletes a row, when it finds a specific number Spiros Excel Discussion (Misc queries) 3 December 4th 07 05:43 AM
Macro that Finds the First Value in a range using a Combobox (drop down menu) [email protected] Excel Worksheet Functions 2 July 12th 07 07:50 PM
Create a macro that finds values then sorts John Hughes Excel Worksheet Functions 2 August 30th 06 12:10 AM
macro that finds text and keeps only part of it john mcmichael Excel Discussion (Misc queries) 5 October 18th 05 10:58 PM


All times are GMT +1. The time now is 09:28 AM.

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"