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

Hi.

When I record a macro,and move to the last cell in a worksheet, the
recorded command is correct as:

ActiveCell.SpecialCells(xlLastCell).Select

However, I then wish to move to the first cell in that last row by way
of the macro but the move gets recorded as an absolute cell reference.
That won't work later when the table size changes.

What is the command to pop left to the first column cell in the
currently occupied (last, in this case) row that does not use any
explicit cell references ("A" is allowed).
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default macro recording


ActiveCell.SpecialCells(xlLastCell).Select
Cells(Selection.Row, "A").Select
or
Cells(Selection.Row, 1).Select

A little more info. If after selecting the last cell, if all cells between
the selected cell and Column A (on the same row as the selected cell) have
data then you can hold the Ctrl key and press left arrow and it would record
as follows.

ActiveCell.SpecialCells(xlLastCell).Select
Selection.End(xlToLeft).Select


--
Regards,

OssieMac


"CellShocked" wrote:

Hi.

When I record a macro,and move to the last cell in a worksheet, the
recorded command is correct as:

ActiveCell.SpecialCells(xlLastCell).Select

However, I then wish to move to the first cell in that last row by way
of the macro but the move gets recorded as an absolute cell reference.
That won't work later when the table size changes.

What is the command to pop left to the first column cell in the
currently occupied (last, in this case) row that does not use any
explicit cell references ("A" is allowed).
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 277
Default macro recording

On Thu, 7 Jan 2010 18:45:01 -0800, OssieMac
wrote:


ActiveCell.SpecialCells(xlLastCell).Select
Cells(Selection.Row, "A").Select
or
Cells(Selection.Row, 1).Select

A little more info. If after selecting the last cell, if all cells between
the selected cell and Column A (on the same row as the selected cell) have
data then you can hold the Ctrl key and press left arrow and it would record
as follows.

ActiveCell.SpecialCells(xlLastCell).Select
Selection.End(xlToLeft).Select



thanx
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default macro recording


Can also find the last used cell in column A with the following. You can
edit column A to any column you wish to find the last used cell in that
column.

Cells(Rows.Count, "A").End(xlUp).Select


The following finds the last used cell in a row. Edit the row number for any
particular row.

Cells(1, Columns.Count).End(xlToLeft).Select

--
Regards,

OssieMac


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
Recording a Macro Sharon Excel Discussion (Misc queries) 5 March 22nd 07 01:40 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
How do I make the Stop Recording bar pop up when recording macros J Excel Worksheet Functions 1 January 10th 06 08:46 PM
Macro recording box Anatoly Excel Programming 2 December 25th 03 04:00 PM


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