Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default XP VBA: Range("A2", ActiveCell.SpecialCells(xlLastCell)).Select

I can use the following to select all the "active" cells:

Range("A2", ActiveCell.SpecialCells(xlLastCell)).Select

....but why can't I use the following to select JUST the last active
cell?

Range(ActiveCell.SpecialCells(xlLastCell)).Select

....am I missing something? I'm trying to get the Row Number of the
last active cell on a sheet and pass it to the next line in the macro.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default XP VBA: Range("A2", ActiveCell.SpecialCells(xlLastCell)).Select

Hi wessman

Don't use SpecialCells(xlLastCell) or UsedRange.Rows.Count
It don't always give you a correct answer

You can use a function
See a example here
http://www.rondebruin.nl/copy1.htm


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"wessman" wrote in message m...
I can use the following to select all the "active" cells:

Range("A2", ActiveCell.SpecialCells(xlLastCell)).Select

...but why can't I use the following to select JUST the last active
cell?

Range(ActiveCell.SpecialCells(xlLastCell)).Select

...am I missing something? I'm trying to get the Row Number of the
last active cell on a sheet and pass it to the next line in the macro.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default XP VBA: Range("A2", ActiveCell.SpecialCells(xlLastCell)).Select

try:
ActiveCell.SpecialCells(xlLastCell).Select




Francisco Mariscal
fcomariscal at hotmail dot com


-----Original Message-----
I can use the following to select all the "active" cells:

Range("A2", ActiveCell.SpecialCells(xlLastCell)).Select

....but why can't I use the following to select JUST the

last active
cell?

Range(ActiveCell.SpecialCells(xlLastCell)).Sele ct

....am I missing something? I'm trying to get the Row

Number of the
last active cell on a sheet and pass it to the next line

in the macro.
.

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
please change Range("AB30").Select to any cell Steved Excel Worksheet Functions 3 October 18th 09 10:03 PM
"Select method of Range class failed" Error Ayo Excel Discussion (Misc queries) 3 September 2nd 08 07:58 PM
Using "=randbetween" to select a number from a range of cells a0xbjzz Excel Worksheet Functions 4 August 4th 07 07:47 PM
Run-time error "1004" Select method of range class failed Tallan Excel Discussion (Misc queries) 3 March 7th 07 05:22 PM
Range("cell").Select Problem CWillis Excel Discussion (Misc queries) 2 June 5th 06 09:16 PM


All times are GMT +1. The time now is 03:34 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"