Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default How to move to 1st cell in next row after exit a particular cell.

Hi all, a newbie question

I need to move to say: A6 after exiting M5, (then to A7 after exiting M6 and
so on...)

Is there a way to do this even if nothing was entered in the M5 cell?

Thanks in advance,
Emilio


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default How to move to 1st cell in next row after exit a particular cell.

Hi Emilio,

Try:
'=============
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Application.EnableEvents = False
If Target.Column = 13 Then 'Column M
Cells(Target.Row + 1, "A").Select
End If
Application.EnableEvents = True

End Sub
'<<=============

This is worksheet event code and should be pasted into the worksheets's code
module (not a standard module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman



"Wind54Surfer" wrote in message
...
Hi all, a newbie question

I need to move to say: A6 after exiting M5, (then to A7 after exiting M6
and
so on...)

Is there a way to do this even if nothing was entered in the M5 cell?

Thanks in advance,
Emilio




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default How to move to 1st cell in next row after exit a particular cell.

Hi Emilio,

Perhaps, nearer to your requirement, try:

'=============
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Application.EnableEvents = False
Cells(Target.Row + 1, "A").Select
Application.EnableEvents = True
End Sub
'<<=============

---
Regards,
Norman


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default How to move to 1st cell in next row after exit a particular cell.

Hi Emilio,

Or, to avoid next row selection if column A is the active column, try:

'=============
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

On Error GoTo XIT
Application.EnableEvents = False
If Target.Column 1 Then
Cells(Target.Row + 1, "A").Select
End If

XIT:
Application.EnableEvents = True
End Sub
'<<=============


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Emilio,

Perhaps, nearer to your requirement, try:

'=============
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Application.EnableEvents = False
Cells(Target.Row + 1, "A").Select
Application.EnableEvents = True
End Sub
'<<=============

---
Regards,
Norman



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default How to move to 1st cell in next row after exit a particular ce

Thanks Norman,

Actually the first answer worked the best.
All I had to do is changed to "14"

Thanks again,
Emilio

"Norman Jones" wrote:

Hi Emilio,

Or, to avoid next row selection if column A is the active column, try:

'=============
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

On Error GoTo XIT
Application.EnableEvents = False
If Target.Column 1 Then
Cells(Target.Row + 1, "A").Select
End If

XIT:
Application.EnableEvents = True
End Sub
'<<=============


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Emilio,

Perhaps, nearer to your requirement, try:

'=============
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Application.EnableEvents = False
Cells(Target.Row + 1, "A").Select
Application.EnableEvents = True
End Sub
'<<=============

---
Regards,
Norman






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
Hit enter in cell & move text down in cell, not go to cell below. raoul_duke Excel Worksheet Functions 4 April 2nd 23 08:37 PM
Macro on exit cell nonshedders Excel Discussion (Misc queries) 1 April 12th 06 12:41 PM
Can't move from one cell and/or enter any data, or exit wksht... Stuck in One cell Excel Discussion (Misc queries) 2 March 28th 05 06:19 AM
mouse move and exit event Shrinu Excel Programming 0 May 27th 04 01:09 AM
Run Macro on cell exit Kelly Excel Programming 7 May 5th 04 09:42 PM


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