#1   Report Post  
Yo
 
Posts: n/a
Default Pressing Enter Key

Hi,

I would like to press the Enter key and have it move Right instead of Down
on one of my excel spreadsheets. I know you can change that option under
tools, but that changes it for every workbook, and I only want that option
on a certain workbook. Is there a way I can make this happen without
changing it everytime I open Excel?

Thanks in advance for your advice.


  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default Pressing Enter Key

Record a macro when you change this setting to right.
Put that code in the workbook_activate event

Record a macro when you change this setting back to down.
Put that code in the workbook_deactivate event.

Both of these events go behind the ThisWorkbook module.

This is what my code looked like:

Option Explicit
Private Sub Workbook_Activate()
Application.MoveAfterReturn = True
Application.MoveAfterReturnDirection = xlToRight
End Sub
Private Sub Workbook_Deactivate()
Application.MoveAfterReturn = True
Application.MoveAfterReturnDirection = xlDown
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Yo wrote:

Hi,

I would like to press the Enter key and have it move Right instead of Down
on one of my excel spreadsheets. I know you can change that option under
tools, but that changes it for every workbook, and I only want that option
on a certain workbook. Is there a way I can make this happen without
changing it everytime I open Excel?

Thanks in advance for your advice.


--

Dave Peterson
  #3   Report Post  
Yo
 
Posts: n/a
Default Pressing Enter Key

Worked Perfectly, Thank You!!




"Dave Peterson" wrote in message
...
Record a macro when you change this setting to right.
Put that code in the workbook_activate event

Record a macro when you change this setting back to down.
Put that code in the workbook_deactivate event.

Both of these events go behind the ThisWorkbook module.

This is what my code looked like:

Option Explicit
Private Sub Workbook_Activate()
Application.MoveAfterReturn = True
Application.MoveAfterReturnDirection = xlToRight
End Sub
Private Sub Workbook_Deactivate()
Application.MoveAfterReturn = True
Application.MoveAfterReturnDirection = xlDown
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Yo wrote:

Hi,

I would like to press the Enter key and have it move Right instead of
Down
on one of my excel spreadsheets. I know you can change that option under
tools, but that changes it for every workbook, and I only want that
option
on a certain workbook. Is there a way I can make this happen without
changing it everytime I open Excel?

Thanks in advance for your advice.


--

Dave Peterson



  #4   Report Post  
David McRitchie
 
Posts: n/a
Default Pressing Enter Key

In this case my event.htm page would be better than my getstarted.htm page.

Specifically for workbook macros which get installed in
ThisWorkbook the shortcut would be:
RightClick on the Excel logo to left of file menu, then use "View Code"

To get to know event macros better see
http://www.mvps.org/dmcritchie/excel/event.htm
and workbook event macros material begin at
http://www.mvps.org/dmcritchie/excel....htm#blueboxWB
---
HTH,
David McRitchie
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm

"Dave Peterson" wrote in message
Both of these events go behind the ThisWorkbook module.
[clipped...]

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm



  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default Pressing Enter Key

I was hoping that with the combination of ThisWorkbook module and your
getstarted page (if the OP had never seen macros) would be sufficient.

But I agree that your event page should have been included. In fact, here's my
standard cut and paste for events:

There are lots of these worksheet/workbook events that you can tie into. Here's
a couple of links that you may want to bookmark:

Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm

======
But I got lazy....

David McRitchie wrote:

In this case my event.htm page would be better than my getstarted.htm page.

Specifically for workbook macros which get installed in
ThisWorkbook the shortcut would be:
RightClick on the Excel logo to left of file menu, then use "View Code"

To get to know event macros better see
http://www.mvps.org/dmcritchie/excel/event.htm
and workbook event macros material begin at
http://www.mvps.org/dmcritchie/excel....htm#blueboxWB
---
HTH,
David McRitchie
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm

"Dave Peterson" wrote in message
Both of these events go behind the ThisWorkbook module.
[clipped...]

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm


--

Dave Peterson
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
How do I follow a hyperlink by just pressing "enter"? Bob Small Excel Discussion (Misc queries) 1 April 5th 05 02:54 PM
How can I follow a Hyper-link by just pressing "Enter"? Bob Excel Discussion (Misc queries) 1 April 5th 05 02:53 PM
Follow hyper-link by pressing "Enter" Bob Small Excel Discussion (Misc queries) 1 April 4th 05 12:46 AM
select the first cell in the next row down after pressing enter o. Taffy Setting up and Configuration of Excel 1 March 1st 05 06:06 PM
How can a hyperlink be opened by pressing Enter. Carolina Excel Discussion (Misc queries) 2 February 17th 05 03:09 PM


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