BIG question

W

Wu

I would like to write a marco that:

Let me input data in a cell, and when I [ENTER], the cursor will move to
right cell to let me input data again..................
 
M

Max

Think you can just change the setting to suit ..
Click Tools > Options > Edit tab
Select as desired from the droplist for "Move selection after Enter",
ie select: Right, then OK out

Voila? Express it, click the YES button below
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:25,000 Files:300 Subscribers:70
xdemechanik
 
W

Wu

I need not only move the cursor to right after inputing data.

How to write the marco to specifiy where the cursor to move after input data
 
W

Wu

But I need not only move to right.

How to write the marco to move to specified direction after [ENTER], such as
move down , move up...............



Max said:
Think you can just change the setting to suit ..
Click Tools > Options > Edit tab
Select as desired from the droplist for "Move selection after Enter",
ie select: Right, then OK out

Voila? Express it, click the YES button below
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:25,000 Files:300 Subscribers:70
xdemechanik
---
Wu said:
I would like to write a marco that:

Let me input data in a cell, and when I [ENTER], the cursor will move to
right cell to let me input data again..................
 
R

Ragdyer

This is one way *without* using a macro:

http://tinyurl.com/2gzlwp

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
Wu said:
I need not only move the cursor to right after inputing data.

How to write the marco to specifiy where the cursor to move after input data



Wu said:
I would like to write a marco that:

Let me input data in a cell, and when I [ENTER], the cursor will move to
right cell to let me input data again..................
 
J

Jacob Skaria

Hi

If you are looking for a macro. Right click the sheet>View Code and paste
the code. The below macro works in the range Col A:B . Move to right from A
to B and then again get back to A...next row..In the below code lngRow and
lngCol determine the next cell . Target.Row is the current row and
Target.Column is the current column. Adjust to suit...


Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngTemp As Range
Dim lngCol As Long, lngRow As Long
Set rngTemp = Range("A:B")
Application.EnableEvents = False
If Not Application.Intersect(Target, rngTemp) Is Nothing Then
lngCol = IIf(Target.Column = rngTemp.Column, _
Target.Column + 1, rngTemp.Column)
lngRow = IIf(Target.Column = rngTemp.Column, _
Target.Row, Target.Row + 1)
Cells(lngRow, lngCol).Select
End If
Application.EnableEvents = True
End Sub


If this post helps click Yes
 
G

Gord Dibben

Private Sub Worksheet_Change(ByVal Target As Range)
'Anne Troy's taborder event code
Dim aTabOrd As Variant
Dim i As Long

'Set the tab order of input cells
aTabOrd = Array("A5", "B22", "C5", "A11", "D10", "F7")

'Loop through the array of cell address
For i = LBound(aTabOrd) To UBound(aTabOrd)
'If the cell that's changed is in the array
If aTabOrd(i) = Target.Address(0, 0) Then
'If the cell that's changed is the last in the array
If i = UBound(aTabOrd) Then
'Select first cell in the array
Me.Range(aTabOrd(LBound(aTabOrd))).Select
Else
'Select next cell in the array
Me.Range(aTabOrd(i + 1)).Select
End If
End If
Next i

End Sub


Gord Dibben MS Excel MVP

But I need not only move to right.

How to write the marco to move to specified direction after [ENTER], such as
move down , move up...............



Max said:
Think you can just change the setting to suit ..
Click Tools > Options > Edit tab
Select as desired from the droplist for "Move selection after Enter",
ie select: Right, then OK out

Voila? Express it, click the YES button below
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:25,000 Files:300 Subscribers:70
xdemechanik
---
Wu said:
I would like to write a marco that:

Let me input data in a cell, and when I [ENTER], the cursor will move to
right cell to let me input data again..................
 
D

Dave

Hi Wu,
If you have a number of cells dotted over your sheet that require data, you
could use the following:
Unlock only the cells you want to enter data into.
Protect the sheet; no need for a password.
Now hit the TAB key.
Successive hits on the TAB key will select each cell you unlocked.
So after data entry, hit TAB instead of enter.
 
S

Shane Devenshire

Hi,

Press Tab instead of Enter to move to the Right
Press Shift+Tab instead of Enter to move to the Left
Press Shift+Enter instead of Enter to move Up

However, if you use the cursor keys instead of Enter you also move in the
appropriate direction - Left, Right, Up or Down arrows keys

All of these enter the data as the move the cursor.
 
R

Rick Rothstein

I believe this shorter code will function identically to the code you
posted...

Private Sub Worksheet_Change(ByVal Target As Range)
' Set the tab order of input cells in a space delimited list
Const aTabOrd As String = "A5 B22 C5 A11 D10 F7"
On Error Resume Next
Range(Trim(Split(Split(aTabOrd & " " & aTabOrd, Target.Address(0, 0) _
& " ", , vbTextCompare)(1))(0))).Select
End Sub

--
Rick (MVP - Excel)


Gord Dibben said:
Private Sub Worksheet_Change(ByVal Target As Range)
'Anne Troy's taborder event code
Dim aTabOrd As Variant
Dim i As Long

'Set the tab order of input cells
aTabOrd = Array("A5", "B22", "C5", "A11", "D10", "F7")

'Loop through the array of cell address
For i = LBound(aTabOrd) To UBound(aTabOrd)
'If the cell that's changed is in the array
If aTabOrd(i) = Target.Address(0, 0) Then
'If the cell that's changed is the last in the array
If i = UBound(aTabOrd) Then
'Select first cell in the array
Me.Range(aTabOrd(LBound(aTabOrd))).Select
Else
'Select next cell in the array
Me.Range(aTabOrd(i + 1)).Select
End If
End If
Next i

End Sub


Gord Dibben MS Excel MVP

But I need not only move to right.

How to write the marco to move to specified direction after [ENTER], such
as
move down , move up...............



Max said:
Think you can just change the setting to suit ..
Click Tools > Options > Edit tab
Select as desired from the droplist for "Move selection after Enter",
ie select: Right, then OK out

Voila? Express it, click the YES button below
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:25,000 Files:300 Subscribers:70
xdemechanik
---
:
I would like to write a marco that:

Let me input data in a cell, and when I [ENTER], the cursor will move
to
right cell to let me input data again..................
 
H

Harlan Grove

Rick Rothstein said:
I believe this shorter code will function identically to the code you
posted...

Private Sub Worksheet_Change(ByVal Target As Range)
  ' Set the tab order of input cells in a space delimited list
  Const aTabOrd As String = "A5 B22 C5 A11 D10 F7"
  On Error Resume Next
  Range(Trim(Split(Split(aTabOrd & " " & aTabOrd, Target.Address(0, 0) _
      & " ", , vbTextCompare)(1))(0))).Select
End Sub
....

Close. Make the C5 address in aTabOrder AC5 instead, then enter
something in C5. FUBAR!

Make the .Select method call

Range(Trim(Split(Split(" " & aTabOrd & " " & aTabOrd, _
" " & Target.Address(0, 0) & " ", , vbTextCompare)(1))(0))).Select

Delimiters are a pain.
 
R

Rick Rothstein

Do you know what annoys me about your posting? The fact that you had to post
it in the first place. I've given that same correction you gave me to others
dozens of times in the past myself (both when volunteering here as well as
when I volunteered in the compiled VB newsgroups)! I was concentrating on
getting the wrap-around effect and completely overlooked the partial match
problem (for which I could just kick myself). Anyway, thanks for catching
this... I really appreciate it.

--
Rick (MVP - Excel)


Rick Rothstein said:
I believe this shorter code will function identically to the code you
posted...

Private Sub Worksheet_Change(ByVal Target As Range)
' Set the tab order of input cells in a space delimited list
Const aTabOrd As String = "A5 B22 C5 A11 D10 F7"
On Error Resume Next
Range(Trim(Split(Split(aTabOrd & " " & aTabOrd, Target.Address(0, 0) _
& " ", , vbTextCompare)(1))(0))).Select
End Sub
....

Close. Make the C5 address in aTabOrder AC5 instead, then enter
something in C5. FUBAR!

Make the .Select method call

Range(Trim(Split(Split(" " & aTabOrd & " " & aTabOrd, _
" " & Target.Address(0, 0) & " ", , vbTextCompare)(1))(0))).Select

Delimiters are a pain.
 

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

Similar Threads


Top