Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default xlLastCell question

I am using Excel 97.

I tried this command in a macro.

ActiveCell.SpecialCells(xlLastCell).Select

I thought that the above command will return the last cell that
contains data. When I issued this command, it returned a cell that was
blank.

I am after the last row in the spreadsheet that contains data. Is
there a better way than the above command ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 473
Default xlLastCell question

Rich wrote:
I tried this command in a macro.

ActiveCell.SpecialCells(xlLastCell).Select

I thought that the above command will return the last cell that
contains data. When I issued this command, it returned a cell that was
blank.


Try
ActiveSheet.UsedRange.SpecialCells(xlLastCell).Sel ect

LastCell gives the cell in the last Row that has been used and the last
Column that has been used since the worksheet was created - or since the
UsedRange method was used on the sheet.


Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup

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
Excel 2007 Macro/VB Question DDE Question MadDog22 Excel Worksheet Functions 1 March 10th 10 01:47 AM
how do i make it so that when a sheat is selected either via link or tab, that xlLastCell is selected. the last on the sheet. Daniel Excel Worksheet Functions 1 July 12th 05 01:30 AM
Cntrl + End (xlLastCell) Bill Excel Discussion (Misc queries) 2 January 22nd 05 03:56 AM
.SpecialCells(xlLastCell).Select jim c. Excel Programming 3 October 3rd 03 04:02 PM
XP VBA: Range("A2", ActiveCell.SpecialCells(xlLastCell)).Select wessman Excel Programming 2 July 23rd 03 06:33 PM


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

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"