Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default How to write macro that selects relative locations

I am using the macro recorder and have it turns to RELATIVE recording rather
than ABSOLUTE recording, but... I cannot figure out how to record navigation
keys relative to my current location. For example, when I press the HOME
key, I want the macro to just go to the far left column for the current row.
When I press the UP ARROW, I want the macro to move up one cell from the
current location. Even with the RELATIVE recording on, it still puts
absolute references in the macro.

How can I get around this? THANKS IN ADVANCE FOR ANY HELP YOU CAN OFFER!


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default How to write macro that selects relative locations

To select the first column of the activecell's row (similar to Home)

Cells(Activecell.Row,1).Select

To move up one cell: ActiveCell.Offset(-1,0).Select
To move down one cell: ActiveCell.Offset(1,0).Select
To move right one cell: ActiveCell.Offset(0,1).Select
To move left one cell: ActiveCell.Offset(0, -1).Select

But you rarely need to select anything....

HTH,
Bernie
MS Excel MVP


"NewKid" wrote in message
...
I am using the macro recorder and have it turns to RELATIVE recording rather
than ABSOLUTE recording, but... I cannot figure out how to record navigation
keys relative to my current location. For example, when I press the HOME
key, I want the macro to just go to the far left column for the current row.
When I press the UP ARROW, I want the macro to move up one cell from the
current location. Even with the RELATIVE recording on, it still puts
absolute references in the macro.

How can I get around this? THANKS IN ADVANCE FOR ANY HELP YOU CAN OFFER!




  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default How to write macro that selects relative locations

Thank you! Worked perfectly!

"Bernie Deitrick" wrote:

To select the first column of the activecell's row (similar to Home)

Cells(Activecell.Row,1).Select

To move up one cell: ActiveCell.Offset(-1,0).Select
To move down one cell: ActiveCell.Offset(1,0).Select
To move right one cell: ActiveCell.Offset(0,1).Select
To move left one cell: ActiveCell.Offset(0, -1).Select

But you rarely need to select anything....

HTH,
Bernie
MS Excel MVP


"NewKid" wrote in message
...
I am using the macro recorder and have it turns to RELATIVE recording rather
than ABSOLUTE recording, but... I cannot figure out how to record navigation
keys relative to my current location. For example, when I press the HOME
key, I want the macro to just go to the far left column for the current row.
When I press the UP ARROW, I want the macro to move up one cell from the
current location. Even with the RELATIVE recording on, it still puts
absolute references in the macro.

How can I get around this? THANKS IN ADVANCE FOR ANY HELP YOU CAN OFFER!





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
can i write a macro to truncate alpha-numeric data? T-Dot Excel Discussion (Misc queries) 2 August 12th 06 08:15 AM
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? Daniel Excel Worksheet Functions 1 June 23rd 05 11:38 PM
Relative Macro Help on Keystrokes Neal Zimm Excel Discussion (Misc queries) 9 December 15th 04 12:31 AM
Record Macro Relative does not work? lbbss Excel Discussion (Misc queries) 3 December 13th 04 08:43 PM
Record Macro Relative does not work? lbbss Excel Discussion (Misc queries) 1 December 13th 04 07:55 PM


All times are GMT +1. The time now is 07:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"