View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Joerg Joerg is offline
external usenet poster
 
Posts: 138
Default How can I advance to the next field automatically?

Would it be a solution to have a separate input cell, where you would input
the name normally (typing continuously, then ENTER)?
The one-letter cells, where you want to end up each character of the entered
name would contain formulas to extract the characters. Data validation is
not required anymore.

Example:
Input cell is A1. Cells B1, C2.... contain the fomulas =MID(A1,1,1) ,
=MID(A1,2,1) etc.

Cheers,

Joerg Mochikun


"Martin Fishlock" wrote in message
...
Hi,

This is not a very elegant way of doing it and I await nicer solutions:

In the worksheet (or workbook) code sheet paste the following.

Sub Worksheet_Activate()
Application.OnKey "A", "Move_A"
Application.OnKey "a", "Move_a"
Application.OnKey "B", "Move_B"
'…. For every key!!!!….
End Sub

Sub Worksheet_Deactivate()
Application.OnKey "A"
End Sub

Thes are in a seperate module (can't get it to work in the worksheet code)
paste the following:

Sub MoveR(c as string)
Application.EnableEvents = False
ActiveCell = c
ActiveCell.Offset(0, 1).Activate
Application.EnableEvents = True
End Sub

Sub Move_A()
MoveR("A")
End Sub
Sub Move_a()
MoveR("A")
End Sub
Sub Move_B()
MoveR("A")
End Sub

There needs to be some tidying up and careful reviewing of the events you
may also need to check the target address to ensure you only deal with the
cells that require special treatment.

I watch with interest on improvements on getting the keystroke or
dynamically calling a macro with onkey (not worked for me as in

application.onkey "mover(""A"")"

--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"crowzhome" wrote:

I have a template that I have created that is to be used for data entry.

I
have a validation on each cell that allows no more than one character.

What
I would like happen is once that character is entered, it automatically

goes
to the next cell w/o having to use the Enter/Tab/Arrow Rgt keys.

For example, for the last name, there is a field for each alpha of the

last
name and right now I have to enter each alpa and then tab to the next

field
and type in the second letter of the last name and then so on and so on.

I
just want to be able to type continuously and have each alpha placed in

the
corresponding column.

I know there has to be a way. Any help would be appreciated.