ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Make [ENTER] always go to Column B of the Next Line (https://www.excelbanter.com/excel-programming/446801-make-%5Benter%5D-always-go-column-b-next-line.html)

magmike[_2_]

Make [ENTER] always go to Column B of the Next Line
 
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

James Ravenswood

Make [ENTER] always go to Column B of the Next Line
 
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

magmike[_2_]

Make [ENTER] always go to Column B of the Next Line
 
On Wednesday, August 8, 2012 11:07:23 AM UTC-5, magmike wrote:
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

pb[_3_]

Make [ENTER] always go to Column B of the Next Line
 
If you want to avoid any VBA, you could always try protecting column A?

-paul



All times are GMT +1. The time now is 07:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com