ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Moving to cell based on condition of another cell (https://www.excelbanter.com/excel-discussion-misc-queries/134996-moving-cell-based-condition-another-cell.html)

tjmny

Moving to cell based on condition of another cell
 
I'm creating a form and want to set it up so that if a data is entered into a
cell, then the cursor goes directly to a cell elsewhere within the
spreadsheet where additional info needs to be entered. Any ideas?

Toppers

Moving to cell based on condition of another cell
 
You could use a macro like this: if data is entered into A1 then C3 is
selected.

To use/test this code, right click on worksheet tab, "view Code" and
copy/paste into code area.


Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit
Application.EnableEvents = False
If Target.Address = "$A$1" Then
Cells(3, "C").Select
End If
ws_exit:
Application.EnableEvents = True
End Sub

"tjmny" wrote:

I'm creating a form and want to set it up so that if a data is entered into a
cell, then the cursor goes directly to a cell elsewhere within the
spreadsheet where additional info needs to be entered. Any ideas?


Gord Dibben

Moving to cell based on condition of another cell
 
Sheet event code? You did say "if data is entered".

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$C$2"
Range("C5").Select
Case "$C$5"
Range("E2").Select
Case "$E$2"
Range("E5").Select
End Select
End Sub

This is event code which runs when a value is entered in one of the trigger
cells.

Right-click on the sheet tab and "View Code". copy/paste the code into that
module.

For non-VBA methods of moving from one cell to another in sequence see Bob
Phillips's site.

http://www.xldynamic.com/source/xld.xlFAQ0008.html


Gord Dibben MS Excel MVP

On Thu, 15 Mar 2007 08:13:51 -0700, tjmny
wrote:

I'm creating a form and want to set it up so that if a data is entered into a
cell, then the cursor goes directly to a cell elsewhere within the
spreadsheet where additional info needs to be entered. Any ideas?



tjmny

Moving to cell based on condition of another cell
 
Gord,

Thanks - it works great.

"Gord Dibben" wrote:

Sheet event code? You did say "if data is entered".

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$C$2"
Range("C5").Select
Case "$C$5"
Range("E2").Select
Case "$E$2"
Range("E5").Select
End Select
End Sub

This is event code which runs when a value is entered in one of the trigger
cells.

Right-click on the sheet tab and "View Code". copy/paste the code into that
module.

For non-VBA methods of moving from one cell to another in sequence see Bob
Phillips's site.

http://www.xldynamic.com/source/xld.xlFAQ0008.html


Gord Dibben MS Excel MVP

On Thu, 15 Mar 2007 08:13:51 -0700, tjmny
wrote:

I'm creating a form and want to set it up so that if a data is entered into a
cell, then the cursor goes directly to a cell elsewhere within the
spreadsheet where additional info needs to be entered. Any ideas?





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

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