Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Getting a cell reference

Hi,

Can someone help me figure out what I'm doing wrong. I need to identify the
last cell reference in a "Used Range." Using the following statement finds
the last cell okay
Sendkeys "^{END}"
but how do I get the reference so I can assign it to a variable? (While the
cell does appear to be selected, the statement
<variable=ActiveCell.Address
returns the reference to the starting cell, not the end cell.

What am I doing wrong?

Thanks,

--
Des )
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Getting a cell reference

Instead of using SendKeys, which can be unreliable in my experience,
(e.g. the keystrokes may get sent to the wrong window) try:

<variable = ActiveCell.SpecialCells(xlCellTypeLastCell).Addres s

You don't need to move to the last cell just to get its address,
but if you need to do so you can say

ActiveCell.SpecialCells(xlCellTypeLastCell).Select




Desmond wrote:
Hi,

Can someone help me figure out what I'm doing wrong. I need to identify the
last cell reference in a "Used Range." Using the following statement finds
the last cell okay
Sendkeys "^{END}"
but how do I get the reference so I can assign it to a variable? (While the
cell does appear to be selected, the statement
<variable=ActiveCell.Address
returns the reference to the starting cell, not the end cell.

What am I doing wrong?

Thanks,

--
Des )


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Getting a cell reference

This was very helpful, thank you!

If, however, I use the "Find" method for instance to locate information and
then need to get that cell reference, how would I do that?

--
Des


"Andrew Taylor" wrote:

Instead of using SendKeys, which can be unreliable in my experience,
(e.g. the keystrokes may get sent to the wrong window) try:

<variable = ActiveCell.SpecialCells(xlCellTypeLastCell).Addres s

You don't need to move to the last cell just to get its address,
but if you need to do so you can say

ActiveCell.SpecialCells(xlCellTypeLastCell).Select




Desmond wrote:
Hi,

Can someone help me figure out what I'm doing wrong. I need to identify the
last cell reference in a "Used Range." Using the following statement finds
the last cell okay
Sendkeys "^{END}"
but how do I get the reference so I can assign it to a variable? (While the
cell does appear to be selected, the statement
<variable=ActiveCell.Address
returns the reference to the starting cell, not the end cell.

What am I doing wrong?

Thanks,

--
Des )



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
Nesting a sheet name reference within a cell reference??? Broyston Excel Discussion (Misc queries) 9 July 8th 08 08:35 PM
Changing sheet reference to cell reference TeeJay Excel Worksheet Functions 3 October 19th 07 11:50 AM
absolute cell reference A spreadsheet cell reference that does no help Excel Discussion (Misc queries) 1 January 18th 06 06:56 PM
problem with cell reference in =sum(offset(cell reference,x,y,z,a)). Want cell ref to be variable. [email protected] Excel Worksheet Functions 2 December 11th 04 12:05 AM
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable [email protected] Excel Worksheet Functions 2 December 11th 04 12:00 AM


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