Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default How to "update" SpecialCells(xlLastCell)

If I delete rows from, say, "A11" to SpecialCells(xlLastCell), the last cell
reference isn't automatically updated to reflect the new "last cell". What
is the syntax or method I need to use so that SpecialCells(xlLastCell) now
points to, say, "H5"? (Or is there a different method of deleting the
selected cells such that it updates automatically?)

Range("A11", ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Delete

ActiveCell.SpecialCells(xlLastCell).Activate
iRow = ActiveCell.Row
iCol = ActiveCell.Column

(I would like iRow and iCol to now point to new Max Row and Max Col)

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to "update" SpecialCells(xlLastCell)

Range("A11", ActiveCell.SpecialCells(xlLastCell)).Select
Selection.EntireRow.Delete
ActiveCell.UsedRange
ActiveCell.SpecialCells(xlLastCell).Activate
iRow = ActiveCell.Row
iCol = ActiveCell.Column

--
Regards,
Tom Ogilvy


"Charlie" wrote in message
...
If I delete rows from, say, "A11" to SpecialCells(xlLastCell), the last

cell
reference isn't automatically updated to reflect the new "last cell".

What
is the syntax or method I need to use so that SpecialCells(xlLastCell) now
points to, say, "H5"? (Or is there a different method of deleting the
selected cells such that it updates automatically?)

Range("A11", ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Delete

ActiveCell.SpecialCells(xlLastCell).Activate
iRow = ActiveCell.Row
iCol = ActiveCell.Column

(I would like iRow and iCol to now point to new Max Row and Max Col)

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default How to "update" SpecialCells(xlLastCell)

"UsedRange" did not appear in my list of items for ActiveCell, (although it
did auto-upcase when I typed it in), and I get an error 438 - Object doesn't
support this property or method. Do I need to add a reference to my VBA
project?

"Tom Ogilvy" wrote:

Range("A11", ActiveCell.SpecialCells(xlLastCell)).Select
Selection.EntireRow.Delete
ActiveCell.UsedRange
ActiveCell.SpecialCells(xlLastCell).Activate
iRow = ActiveCell.Row
iCol = ActiveCell.Column

--
Regards,
Tom Ogilvy


"Charlie" wrote in message
...
If I delete rows from, say, "A11" to SpecialCells(xlLastCell), the last

cell
reference isn't automatically updated to reflect the new "last cell".

What
is the syntax or method I need to use so that SpecialCells(xlLastCell) now
points to, say, "H5"? (Or is there a different method of deleting the
selected cells such that it updates automatically?)

Range("A11", ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Delete

ActiveCell.SpecialCells(xlLastCell).Activate
iRow = ActiveCell.Row
iCol = ActiveCell.Column

(I would like iRow and iCol to now point to new Max Row and Max Col)

Thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to "update" SpecialCells(xlLastCell)

Typo

ActiveCell.UsedRange

should be

ActiveSheet.UsedRange

--
Regards,
Tom Ogilvy

"Charlie" wrote in message
...
"UsedRange" did not appear in my list of items for ActiveCell, (although

it
did auto-upcase when I typed it in), and I get an error 438 - Object

doesn't
support this property or method. Do I need to add a reference to my VBA
project?

"Tom Ogilvy" wrote:

Range("A11", ActiveCell.SpecialCells(xlLastCell)).Select
Selection.EntireRow.Delete
ActiveCell.UsedRange
ActiveCell.SpecialCells(xlLastCell).Activate
iRow = ActiveCell.Row
iCol = ActiveCell.Column

--
Regards,
Tom Ogilvy


"Charlie" wrote in message
...
If I delete rows from, say, "A11" to SpecialCells(xlLastCell), the

last
cell
reference isn't automatically updated to reflect the new "last cell".

What
is the syntax or method I need to use so that SpecialCells(xlLastCell)

now
points to, say, "H5"? (Or is there a different method of deleting the
selected cells such that it updates automatically?)

Range("A11", ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Delete

ActiveCell.SpecialCells(xlLastCell).Activate
iRow = ActiveCell.Row
iCol = ActiveCell.Column

(I would like iRow and iCol to now point to new Max Row and Max Col)

Thanks






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default How to "update" SpecialCells(xlLastCell)

Found it:

ActiveSheet.UsedRange

Thanks

"Tom Ogilvy" wrote:

Range("A11", ActiveCell.SpecialCells(xlLastCell)).Select
Selection.EntireRow.Delete
ActiveCell.UsedRange
ActiveCell.SpecialCells(xlLastCell).Activate
iRow = ActiveCell.Row
iCol = ActiveCell.Column

--
Regards,
Tom Ogilvy


"Charlie" wrote in message
...
If I delete rows from, say, "A11" to SpecialCells(xlLastCell), the last

cell
reference isn't automatically updated to reflect the new "last cell".

What
is the syntax or method I need to use so that SpecialCells(xlLastCell) now
points to, say, "H5"? (Or is there a different method of deleting the
selected cells such that it updates automatically?)

Range("A11", ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Delete

ActiveCell.SpecialCells(xlLastCell).Activate
iRow = ActiveCell.Row
iCol = ActiveCell.Column

(I would like iRow and iCol to now point to new Max Row and Max Col)

Thanks




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
"CELL("FILENAME") NOT UPDATE AFTER "SAVE AS" ACTION yossie6 Excel Discussion (Misc queries) 1 June 16th 08 12:16 PM
.Cells.SpecialCells(xlLastCell) Simon Shaw Excel Programming 8 May 5th 05 11:46 PM
SpecialCells(xlLastCell) José Ignacio Bella Excel Programming 12 January 9th 05 07:20 PM
.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 10:55 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"