Make [ENTER] always go to Column B of the Next Line

M

magmike

Is there a way to override Excel's desire to go to the cell it thinks I want it to go to, and using VB force Excel to send the selection to the 2nd Column of the next line when the ENTER key is used?

magmike
 
J

James Ravenswood

This will work if if you type a value and then the ENTER key. Install the following event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim roww As Long
roww = Target.Row + 1
Cells(roww, 2).Select
End Sub


Because it is worksheet code, it is very easy to install and automatic to use:

1. right-click the tab name near the bottom of the Excel window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you have any concerns, first try it on a trial worksheet.

If you save the workbook, the macro will be saved with it.


To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm
 
M

magmike

Is there a way to override Excel's desire to go to the cell it thinks I want it to go to, and using VB force Excel to send the selection to the 2nd Column of the next line when the ENTER key is used? magmike

Thanks for the idea James. Unfortunately, this works too well. It is predicated on a change being made, and not the use of the Enter key. If I make a change and hit tab to go to the cell in the column to the right of my current selection, I instead get sent to the next line before I am ready. I am also hopeful to find a way to do this that would send me to Column B of the next line after hitting ENTER, even if a change was not made.

Anyother ideas?

magmike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top