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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
In what way is your Worksheet_Change code failing to do what you want?
 
Last edited:
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0
Even if E3 is locked, the code still selects it, though I can't edit it.
 
Upvote 0
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?
 
Upvote 0
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!
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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