ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to "update" SpecialCells(xlLastCell) (https://www.excelbanter.com/excel-programming/333036-how-update-specialcells-xllastcell.html)

Charlie

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

Tom Ogilvy

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




Charlie

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





Tom Ogilvy

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







Charlie

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






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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com