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 NAME
(B3)
CITYSTATEZIP CODE
(B9) (E9)
PHONE NO.
(B12)

<tbody>
[TD="colspan: 3"] LAST NAME [/TD]

[TD="colspan: 3"] (E3)[/TD]

[TD="colspan: 4"][/TD]

[TD="colspan: 4"] ADDRESS [/TD]

[TD="colspan: 4"] (B6) [/TD]

[TD="colspan: 4"][/TD]

[TD="colspan: 2"] (F9)[/TD]

[TD="colspan: 4"][/TD]

[TD="colspan: 3"] CONTACT NAME [/TD]

[TD="colspan: 3"] (E12)[/TD]

</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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
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,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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