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

John.McLaughlin

Board Regular
Joined
Jul 19, 2011
Messages
169
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.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
If you upload the file & mark for sharing, you should get a link which you can then post to the thread.
 
Upvote 0
Did you mark the file for sharing, because it's asking me to log-in?
 
Upvote 0
Something isn't quite right with that link but I did manage to get to the file eventually.


Works perfectly for me so I'm at a loss as to what can be wrong at your end.
If you haven't done so already I would suggest closing right out of Excel, then reopen just that test file & try again.


Edit: I think the link should be this
https://www.dropbox.com/s/hurk0jl6auc0h3f/peter-ss.xlsm?dl=0
 
Last edited:
Upvote 0
I disabled the "after pressing enter" in the advanced options, the cell stays selected.

Most puzzling, 2 different machines (same license w/ MS 5 license agreement), and new workbooks?

Thank you for your efforts, I'll update the thread if I ever discover what fixed it.
 
Last edited:
Upvote 0
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?

Just for information,
SetOnKey is a code that formed part of a tabbing solution developed by myself & @Jerry Sullivan MVP on this forum sometime ago & would not likely assist you with this particular problem which I now see you have had help resolving

Dave
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,506
Members
449,089
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top