I want to control the order of cell selection during data entry.

John.McLaughlin

Board Regular
Joined
Jul 19, 2011
Messages
127
I have a simple worksheet to enter customer Info. I want to control the order of cell selection and reduce the users need to Tab Right.


  1. User enters First Name, press enter VBA to bounce right and enter Last Name (instead of Tab Right)
  2. After Last Name is entered, press enter VBA to drop down to address.
  3. After address is entered, VBA to drop down to City, VBA bounce right for state, VBA bounce right for zip.
  4. Lastly, drop down to phone number, VBA bounce right for contact name

FIRST NAMELAST NAME
(B3) (E3)
ADDRESS
(B6)
CITYSTATEZIP CODE
(B9) (E9) (F9)
PHONE NO.CONTACT NAME
(B12) (E12)

<tbody>
</tbody>

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$B$3"
    Range("E3").Activate
Case "$E$3"
    Range("B6").Activate
Case "$B$6"
    Range("B9").Activate
Case "$B$9"
    Range("E9").Activate
Case "$E$9"
    Range("F9").Activate
Case "$F$9"
    Range("B12").Activate
Case "$B$12"
    Range("E12").Activate
End Select
End Sub
I have also added to the top of the Worksheet module;

Code:
Private Sub Workbook_Open()
   If ActiveSheet.Name = "ORDER" Then SetOnkey True
End Sub
Nothing seems to work? Any ideas?

Thanks in advance.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
42,237
Office Version
365
Platform
Windows
In what way is your Worksheet_Change code failing to do what you want?
 
Last edited:

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,206
Office Version
365
Platform
Windows
You change event works for me, have you put it in the correct sheet module?

Another option is to unlock those cells & then protect sheet with "select locked cells" unchecked.
 

John.McLaughlin

Board Regular
Joined
Jul 19, 2011
Messages
127
In what way is your Worksheet_Change code failing to do what you want?

It skips the Last Name (E3) and drops straight to Address (B6)


You change event works for me, have you put it in the correct sheet module?


Another option is to unlock those cells & then protect sheet with "select locked cells" unchecked.

Yes, correct module, and yes, I use protect sheet/uncheck select locked cells to skip unused cells (blank rows)


Is there a global setting I missed?


I also have a private sub in the module to highlight the cell selection, but removing that didn't fix the issue either.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
42,237
Office Version
365
Platform
Windows
It skips the Last Name (E3) and drops straight to Address (B6)
It didn't for me, or for Fluff by the sound of it, so I'm not sure what is going on in your sheet.
Try putting that change code into a sheet in a fresh workbook and see what happens.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
32,206
Office Version
365
Platform
Windows
Even if E3 is locked, the code still selects it, though I can't edit it.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
42,237
Office Version
365
Platform
Windows
Still nothing, would that point to a preference setting ?
Not that I can think of but very strange if that was a completely new workbook.
Presumably that new workbook has nothing else in it other than a blank (unprotected) worksheet & that one code so perhaps you could upload it to Dropbox, OneDrive or similar so that we could access it to see what it does for us?
 

John.McLaughlin

Board Regular
Joined
Jul 19, 2011
Messages
127
Not that I can think of but very strange if that was a completely new workbook.
Presumably that new workbook has nothing else in it other than a blank (unprotected) worksheet & that one code so perhaps you could upload it to Dropbox, OneDrive or similar so that we could access it to see what it does for us?
Yes, blank workbook, one macro, just tried it at work and same result, cursor drops down to B6 and does not go to E3?

I don't have a cloud file sharing service, can you PM your email maybe?

Thank You!
 

Forum statistics

Threads
1,081,995
Messages
5,362,610
Members
400,684
Latest member
Vie

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top